[Bug c++/42121] g++ should warn or error on internal 0 size array in struct
redi at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Nov 20 18:50:00 GMT 2009
------- Comment #3 from redi at gcc dot gnu dot org 2009-11-20 18:49 -------
(In reply to comment #2)
> In standard C, a size 0 array is forbidden, at least in C99 doc I have handy,
Yes, but it's a long-standing GNU extension:
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Zero-Length.html#Zero-Length
The C++ front end says:
/* As an extension we allow zero-sized arrays. We always allow
them in system headers because glibc uses them. */
Maybe the C++ front-end could be made stricter, so that it accepts char b[0]
(like the C front end) but not char b[] (which is a C99 flexible array member,
and must be the last member)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42121
More information about the Gcc-bugs
mailing list