-
- Downloads
c: Diagnose compound literal for empty array [PR114266]
As reported in bug 114266, GCC fails to pedwarn for a compound literal, whose type is an array of unknown size, initialized with an empty initializer. This case is disallowed by C23 (which doesn't have zero-size objects); the case of a named object is diagnosed as expected, but not that for compound literals. (Before C23, the pedwarn for empty initializers sufficed.) Add a check for this specific case with a pedwarn. Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/114266 gcc/c/ * c-decl.cc (build_compound_literal): Diagnose array of unknown size with empty initializer for C23. gcc/testsuite/ * gcc.dg/c23-empty-init-4.c: New test.
Loading
Please register or sign in to comment