[Bug c/92571] New: gcc erroneously rejects , operator in array dimensions as syntax error
bugdal at aerifal dot cx
gcc-bugzilla@gcc.gnu.org
Mon Nov 18 23:31:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92571
Bug ID: 92571
Summary: gcc erroneously rejects , operator in array dimensions
as syntax error
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: bugdal at aerifal dot cx
Target Milestone: ---
void foo()
{
int a[1,1];
}
produces:
error: expected ']' before ',' token
despite the declaration being a valid (variable length, since the comma
operator cannot participate in an integer constant expression) array
declaration.
I found this while testing for whether -Wvla would catch such "gratuitously
variable-length" arrays due to comma operator. Obviously this should be caught
by both that and whatever warning is appropriate for "you probably meant
multi-dimensional array". But it is valid C and should not be rejected as a
syntax error.
More information about the Gcc-bugs
mailing list