This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51034] invalid typeof usage
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Nov 2011 00:41:18 +0000
- Subject: [Bug c/51034] invalid typeof usage
- Auto-submitted: auto-generated
- References: <bug-51034-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51034
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-11-09 00:41:18 UTC ---
Also applies with sizeof:
struct S { int x[sizeof((struct S){})];} s;
and when the type in the compound literal is not the type being defined:
struct S { int x[sizeof((struct T){})];} s;
All the invalid cases will still be diagnosed with -std=c99
-pedantic-errors because either the empty braces will be diagnosed or
excess elements in an initializer will be diagnosed. But there ought to
be an unconditional hard error for using an incomplete type, other than an
array of unknown size, like that in a compound literal.