[Bug c++/89331] [8/9 Regression] internal compiler error: in build_simple_base_path, at cp/class.c:589

stsp at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Wed Feb 13 13:33:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89331

--- Comment #2 from Stas Sergeev <stsp at users dot sourceforge.net> ---
(In reply to Jakub Jelinek from comment #1)
> Simplified testcase:
> struct A { char a; };
> struct B : public A { static constexpr int b = __builtin_offsetof (B, a); };
> 
> clang rejects this too, not really sure if it is valid or not.

Thanks for taking a look!
A slight off-topic: any idea why even this rejects:
struct A {
    char a;
    static constexpr int b = __builtin_offsetof (A, a);
};

and is there any work-around when I want to
pass offsetof value into a template non-type,
which also rejects:
struct A {
    char a;
    B<__builtin_offsetof(A, a)> b;
};

Does the standard explicitly forbids that, of just gcc?


More information about the Gcc-bugs mailing list