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

            Bug ID: 40744
           Summary: [RFE] allow offsetof() in constexpr
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: s...@list.ru
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

The below examples reject:

struct A {
    char a;
    static constexpr int b = offsetof(A, a);
};

struct A {
    char a;
    B<offsetof(A, a)> b;
};


And there seem to be no easy work-around.
On stackoverflow people suggest the reinterpret_cast-based
solutions, which are illegal in constexpr too.
Is there anything in standard, that makes this code invalid?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to