https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108036

Daniel Lundin <daniel.lundin.mail at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.lundin.mail at gmail 
dot co
                   |                            |m

--- Comment #8 from Daniel Lundin <daniel.lundin.mail at gmail dot com> ---
I don't believe char past_end[0] is valid C, because it is an invalid array
declaration. Unlike [] or [*] that declares an array of incomplete type. 

Since it is a function parameter, it will of course later get adjusted to a
pointer to the first element. But it still has to be a valid declaration to
begin with. Similarly, char arr[][] is invalid because it remains an incomplete
type after adjustment (see C17 6.7.6.4 ยง4).

gcc does allow [0] as an extension since that was commonly used for purposes of
implementing the "struct hack" back in the days before flexible array members
were standardized.

The conclusion ought to be that gcc should let [0] through if compiled in
-std=gnu23 mode but not in -std=c23 and/or -pedantic.
  • [Bug middle-end/108036] [... daniel.lundin.mail at gmail dot com via Gcc-bugs

Reply via email to