[Bug c/115566] Arrays of character type initialized with parenthesized string literals shouldn't be diagnosed with -pedantic (at least in C2Y)
luigighiron at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 23 21:03:00 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115566
--- Comment #14 from Halalaluyafail3 <luigighiron at gmail dot com> ---
(In reply to Joseph S. Myers from comment #13)
> I think it's clear that where the question is the *syntax* of an
> initializer, an actual string literal token is required up to C23 (and
> accepting _Generic there is a bug); it's only for semantic properties such
> as "lvalue" and "integer constant expression" and "immediate operand of
> cast" that parentheses and _Generic should be transparent.
The wording about string literals in question is not under Syntax, so I would
not expect it to be a syntactical property. If it is meant to be interpreted
syntactically however, then I would expect the following declaration to also be
invalid:
int x={0,};
Since {0,} is not syntactically an expression, nor an expression enclosed in
braces. Therefore it should not be a valid initializer for an object with
scalar type.
More information about the Gcc-bugs
mailing list