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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to