[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:21:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40076
--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-02 20:20:53 UTC ---
(In reply to comment #5)
> That's correct for C++ (by the analogy discussed in this bug report), but
> not for C.
My fault. Clang pays more attention to the file extension than to the driver
used. The correct output for C is:
test.c:1:9: error: initializer element is not a compile-time constant
int i = (struct s3 { int j; }) { 1 }.j;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated
which makes the error clearer than in gcc because of the caret location and the
range (plus the beautiful colors ;-).
More information about the Gcc-bugs
mailing list