[Bug c++/42121] g++ should warn or error on internal 0 size array in struct
david dot resnick at comverse dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 20 18:38:00 GMT 2009
------- Comment #2 from david dot resnick at comverse dot com 2009-11-20 18:38 -------
(In reply to comment #1)
> Looks like this is for compatibility with GNU C, which allows it, but only in
> the form char b[0] not char b[]
b[] seems simply broken unless last in an array for the C99 "flexible array
member" type stuff, no? I'm not really convinced about the merits/utility of
b[0] as an internal struct field either, it is an odd way to make a union
maybe?
In standard C, a size 0 array is forbidden, at least in C99 doc I have handy,
per constraint in section 6.7.5.2 indicating:
Constraints
[#1] The [ and ] may delimit an expression or *. If [ and ]
delimit an expression (which specifies the size of an
array), it shall have an integer type. If the expression is
a constant expression then it shall have a value greater
than zero. The element type shall not be an incomplete or
function type.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42121
More information about the Gcc-bugs
mailing list