https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94132
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Blocks| |69698 Resolution|--- |INVALID --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- Right, the code is invalid according to the C rules. It's accepted by the C front end with a pedantic warning. It's intentionally rejected by the C++ front-end which supports fewer of the GCC extensions. The zero-length array extension can be used in this context instead, though accessing elements of the zero-length array may be diagnosed. (In both cases, GCC assumes that the array doesn't overlap other members so accesses to its elements are undefined.) Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69698 [Bug 69698] [meta-bug] flexible array members