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

The overloadable attribute is sensitive to the syntactic position of the attribute #53805

Closed
AaronBallman opened this issue Feb 13, 2022 · 4 comments
Labels
c clang:frontend Language frontend issues, e.g. anything involving "Sema" rejects-valid

Comments

@AaronBallman
Copy link
Collaborator

Consider:

__attribute__((overloadable)) void func_bad(...); // error

void func_good(...) __attribute__((overloadable)); // okay

[[clang::overloadable]] void func_also_bad(...); // error
void func_also_bad_again(...) [[clang::overloadable]]; // error, this is the only diagnostic that makes sense to me

void okay_now_Im_just_baffled [[clang::overloadable]](...); // okay

The only diagnostic that makes sense (to me) is the one on func_also_bad_again() due to it being written in the type position and not being a type attribute.

https://godbolt.org/z/7qWjWdbGP is a live example. I think the two cases labeled error with no other comments should also be accepted.

@AaronBallman AaronBallman added c rejects-valid clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer labels Feb 13, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 13, 2022

@llvm/issue-subscribers-c

@AaronBallman
Copy link
Collaborator Author

https://reviews.llvm.org/D119664 should address this

@AaronBallman
Copy link
Collaborator Author

Fixed in 76032b0.

@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer labels Jan 20, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 20, 2024

@llvm/issue-subscribers-clang-frontend

Author: Aaron Ballman (AaronBallman)

Consider: ``` __attribute__((overloadable)) void func_bad(...); // error

void func_good(...) attribute((overloadable)); // okay

[[clang::overloadable]] void func_also_bad(...); // error
void func_also_bad_again(...) [[clang::overloadable]]; // error, this is the only diagnostic that makes sense to me

void okay_now_Im_just_baffled [clang::overloadable]; // okay

The only diagnostic that makes sense (to me) is the one on `func_also_bad_again()` due to it being written in the type position and not being a type attribute.

https://godbolt.org/z/7qWjWdbGP is a live example. I think the two cases labeled `error` with no other comments should also be accepted.
</details>

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

3 participants