_Generic in C++ doesn't allow an elaborated type specifier as an association · Issue #55562 · llvm/llvm-project (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
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.