https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116281
Bug ID: 116281
Summary: Comma operator used in the middle operand of a
conditional expression is incorrectly rejected in non
static data member initializer
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: luigighiron at gmail dot com
Target Milestone: ---
When a comma operator is used in the middle operand of a conditional expression
in a non static data member initializer while not being surrounded in
parentheses, brackets, braces, or angle brackets GCC will interpret the comma
as delimiting another member-declarator in a member-declarator-list and
subsequently reject the program. The following is an example:
struct x{
int y=0?0,0:0;
};
int main(){}
GCC rejects this program when it should be valid. Clang accepts it, MSVC also
rejects it.