_Generic in C++ doesn't allow an elaborated type specifier as an association (original) (raw)
Clang supports _Generic
as an extension in C++ mode, but the following C++ code doesn't parse when it should:
struct S { int i; };
void func(struct S s) {
(void)_Generic(s, struct S : 1); // error: 'S' cannot be defined in a type specifier
error: expected class name
error: expected '{' after base class list
}
This use is not defining a new type specifier, it's attempting to use an elaborated type specifier for referencing the type.