This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78551] [5/6/7 Regression] Internal compiler error with constexpr initialization of union
- From: "vlad at petric dot cc" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 02 Dec 2016 03:48:26 +0000
- Subject: [Bug c++/78551] [5/6/7 Regression] Internal compiler error with constexpr initialization of union
- Auto-submitted: auto-generated
- References: <bug-78551-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78551
--- Comment #7 from Vlad Petric <vlad at petric dot cc> ---
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'};