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++/40076] g++ should not permit types to be defined in compound literals


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 ;-).


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