https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114266
Bug ID: 114266 Summary: No -pedantic diagnostic for zero-sized array in compound literals Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: daniel.lundin.mail at gmail dot com Target Milestone: --- (int[]){}; produces no diagnostics with -std=c23 -pedantic. Empty initalizer lists are OK under -std=c23 and -std=gnu so that's not the problem. gcc correctly gives a diagnostic for that in -std=c17 -pedantic mode. Zero-sized arrays should however give a diagnostic in -std=cxx -pedantic mode. Prior to C23 this was not really a problem as we would get a diagnostic for the empty initializer list. But now this non-conforming C compiles cleanly even with -pedantic set. A diagnostic similar to the one given in clang would be good: warning: zero size arrays are an extension [-Wzero-length-array] As I understand it, gcc did have -Wzero-length-array in the past but removed it? See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94428. The options -Wstrict-flex-arrays -fstrict-flex-arrays seem to have no effect (and my example isn't a flexible array member but a compound literal).