http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40076
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-05-02 20:13:02 UTC --- On Wed, 2 May 2012, manu at gcc dot gnu.org wrote: > 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++. That's correct for C++ (by the analogy discussed in this bug report), but not for C. > pr40076.cc:1:17: error: initializer element is not constant > int i = (struct s3 { int j; }) { 1 }.j; > ^ > > which is less clear. That's a correct error for C, however; C allows types to be defined like that in sizeof, casts and compound literals, but that initializer is not (required to be) constant in C standard terms.