[llvm-bugs] [Bug 26117] New: msvc-cl and clang-cl disagree on what can be static_asserted

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 11 11:37:11 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26117

            Bug ID: 26117
           Summary: msvc-cl and clang-cl disagree on what can be
                    static_asserted
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jmuizelaar at mozilla.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following program compiles with msvc-cl but does not with clang-cl.

The Offsetof macro is the one from msvc's stddef.h

#include <stdint.h>

#define Offsetof(s,m)   (size_t)( (ptrdiff_t)&reinterpret_cast<const volatile
char&>((((s *)0)->m)) )

struct MyClass {
  int myMem;
};

static_assert(Offsetof(MyClass, myMem) == 0, "boom");

You can run into this when pre-processing source from msvc to compile with
clang-cl.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160111/62bce98c/attachment.html>


More information about the llvm-bugs mailing list