https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113812
Bug ID: 113812 Summary: Comma expression parsed as declaration when ambiguous type name cast is present Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- void f() { int(x), a, b, c, d, e, f, g, h, etc; int(x), a, b, c, d, e, f, g, h, etc, (new int); } Clang parses this fine, but GCC errors out, complaining that: <source>: In function 'void f()': <source>:4:9: error: redeclaration of 'int x' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:9: note: 'int x' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:13: error: redeclaration of 'int a' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:13: note: 'int a' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:16: error: redeclaration of 'int b' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:16: note: 'int b' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:19: error: redeclaration of 'int c' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:19: note: 'int c' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:22: error: redeclaration of 'int d' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:22: note: 'int d' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:25: error: redeclaration of 'int e' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:25: note: 'int e' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:28: error: redeclaration of 'int f' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:28: note: 'int f' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:31: error: redeclaration of 'int g' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:31: note: 'int g' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:34: error: redeclaration of 'int h' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^ <source>:3:34: note: 'int h' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^ <source>:4:37: error: redeclaration of 'int etc' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^~~ <source>:3:37: note: 'int etc' previously declared here 3 | int(x), a, b, c, d, e, f, g, h, etc; | ^~~ <source>:4:43: error: expected unqualified-id before 'new' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ^~~ <source>:4:43: error: expected ')' before 'new' 4 | int(x), a, b, c, d, e, f, g, h, etc, (new int); | ~^~~ | ) It appears that GCC is treating the second statement in the function as a declaration instead of a comma expression, which Clang does.