Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_Generic in C++ doesn't allow an elaborated type specifier as an association #55562

Closed
AaronBallman opened this issue May 18, 2022 · 2 comments
Closed
Labels
c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" rejects-valid

Comments

@AaronBallman
Copy link
Collaborator

AaronBallman commented May 18, 2022

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.

@AaronBallman AaronBallman added c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" rejects-valid labels May 18, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented May 18, 2022

@llvm/issue-subscribers-c-1

@llvmbot
Copy link
Collaborator

llvmbot commented May 18, 2022

@llvm/issue-subscribers-clang-frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" rejects-valid
Projects
None yet
Development

No branches or pull requests

2 participants
  翻译: