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

            Bug ID: 35327
           Summary: constexpr initialization with reinterpret_cast
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: ivan.donchevs...@qt.io
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

By standard it should not be possible but msvc (at least 2015 and 2017)
compiles fine with that. clang-cl fails trying to compile the same code.

Can be noticed in offsetof calls or similar declarations.

Example:

#define my_offsetof(s,m) ((int)&reinterpret_cast<char const
volatile&>((((s*)0)->m)))
struct Foo { int Bar;};
static constexpr int offset= my_offsetof(Foo, Bar);

This code compiles fine with cl but fails 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