[Bug c++/40076] g++ should not permit types to be defined in compound literals

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 2 20:04:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40076

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-02
                 CC|                            |manu at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-02 20:04:08 UTC ---
I think this is confirmed. Clang prints:

pr40076.cc:1:17: error: 's3' can not be defined in a type specifier
int i = (struct s3 { int j; }) { 1 }.j;
                ^
1 error generated.

for both C and C++.

GCC prints:

pr40076.cc:1:17: error: initializer element is not constant
 int i = (struct s3 { int j; }) { 1 }.j;
                 ^

which is less clear.



More information about the Gcc-bugs mailing list