Consider this: struct s { char c[]; }; int main() { struct s s = { .c = 0 }; return 0; } Compiling with 'g++ -Wall h.c' gives infinite warnings: h.c: In function 'int main()': h.c:5:24: warning: missing braces around initializer for 'char [0]' [-Wmissing-braces] h.c:5:24: warning: missing braces around initializer for 'char [0]' [-Wmissing-braces] h.c:5:24: warning: missing braces around initializer for 'char [0]' [-Wmissing-braces] h.c:5:24: warning: missing braces around initializer for 'char [0]' [-Wmissing-braces] ... Version: GNU C++ (GCC) version 4.7.0 Target: x86_64-unknown-linux-gnu
Confirmed. 4.6 rejects the testcase with t.C: In function 'int main()': t.C:5:22: error: expected primary-expression before '.' token t.C:5:16: warning: unused variable 's' [-Wunused-variable]
Author: jason Date: Wed Sep 5 04:17:12 2012 New Revision: 190962 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190962 Log: PR c++/54441 * decl.c (reshape_init_class): Handle invalid initializer for 0-length array member. * error.c (dump_type_suffix): Correct handling of 0-length arrays. Added: trunk/gcc/testsuite/g++.dg/ext/flexary3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/error.c trunk/gcc/testsuite/ChangeLog
Fixed.