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: unassignedclangb...@nondot.org
          Reporter: jmuizel...@mozilla.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to