Currently, Clang accepts this code in C mode (where the tag is required to be used) but rejects it in C++ mode thinking that the association is defining a new type.
void foo(void) { struct S { int a; }; _Generic(something, struct S : 1); }
Clang thinks this in C++ because it sees struct S : when parsing the class specifier and decides that must be a type definition (because the colon signifies the presence of a base class type). This patch adds a new declarator context to represent a _Generic association so that we can distinguish these situations properly.
Fixes #55562
Is this right? According to the comment, this is 'true'if the identifier is optional or required, but the mayOmitIdentifier, where you are returning 'true' says optional or not allowed? Does this make identifier 'not allowed' here?