This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78551] [5/6/7 Regression] Internal compiler error with constexpr initialization of union


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

--- Comment #8 from Vlad Petric <vlad at petric dot cc> ---
(In reply to Vlad Petric from comment #7)
> Ok, so the example that I started this bug with is not standard compliant
> because it initialized different elements in a union with the constexpr
> constructor.
> 
> The following does just one. I believe that the following is
> standard-compliant code (though obviously I could be wrong)
> 
> And it generates a segfault.
> 
> struct A {
>   union {
>     long s;
>     char d[4];
>   };
>   constexpr A (char x) : d("") { d[0] = x; }
> };
> 
> A a{'a'};

clang 3.8/4.0 have no problem with the above code.

Personally I think that we should change the main attachment and the tag - to
segfault on valid code (worse than ICE ...).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]