[Bug c/114266] No -pedantic diagnostic for zero-sized array in compound literals

2024-03-07 Thread daniel.lundin.mail at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114266

--- Comment #3 from Daniel Lundin  ---
(In reply to Joseph S. Myers from comment #2)
> The relevant constraint here is "An array of unknown size shall not be
> initialized by an empty initializer.".

Indeed! I didn't realize it was also a constraint (C23 6.7.10). That probably
means that a diagnostic warning should always be given and not just in
-pedantic mode.

[Bug c/114266] No -pedantic diagnostic for zero-sized array in compound literals

2024-03-07 Thread jsm28 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114266

Joseph S. Myers  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2024-03-07

--- Comment #2 from Joseph S. Myers  ---
The relevant constraint here is "An array of unknown size shall not be
initialized by an empty initializer.".

[Bug c/114266] No -pedantic diagnostic for zero-sized array in compound literals

2024-03-07 Thread daniel.lundin.mail at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114266

--- Comment #1 from Daniel Lundin  ---
Created attachment 57643
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57643&action=edit
Complete example