This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66644] New: Rejects C++11 in-class anonymous union members initialization
- From: "bisqwit at iki dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 23 Jun 2015 19:02:23 +0000
- Subject: [Bug c++/66644] New: Rejects C++11 in-class anonymous union members initialization
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66644
Bug ID: 66644
Summary: Rejects C++11 in-class anonymous union members
initialization
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bisqwit at iki dot fi
Target Milestone: ---
Accepted by GCC:
struct test
{ union
{
struct { char a=0, b; };
char buffer[16];
}; };
NOT accepted by GCC (multiple fields in union 'test::<anonymous union>'
initialized):
struct test
{ union
{
struct { char a=0, b=0; };
char buffer[16];
}; };
Still accepted by GCC:
struct test
{ union
{
struct { char a, b; } test2{0,
char buffer[16];
}; };
I think there's a compiler bug here. It should not complain about initializing
multiple fields in a struct that is nested inside the union, because this does
not comprise a conflict.
Tested on GCC versions 4.7.4, 4.8.4, 4.9.2, and 5.1.1.