Skip to content

[[deprecated]] applied to local variables #90073

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

Closed
cor3ntin opened this issue Apr 25, 2024 · 4 comments · Fixed by #113575
Closed

[[deprecated]] applied to local variables #90073

cor3ntin opened this issue Apr 25, 2024 · 4 comments · Fixed by #113575
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party

Comments

@cor3ntin
Copy link
Contributor

GCC warns on local variables marked [[deprecated]]
https://compiler-explorer.com/z/nvfdTeveP

This behavior seems to be backed by the standard https://eel.is/c++draft/dcl.attr#deprecated-2.sentence-1

Should we follow suite? Arguably, it would be of limited usefulness.

@cor3ntin cor3ntin added clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer labels Apr 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2024

@llvm/issue-subscribers-clang-frontend

Author: cor3ntin (cor3ntin)

GCC warns on local variables marked `[[deprecated]]` https://compiler-explorer.com/z/nvfdTeveP

This behavior seems to be backed by the standard https://eel.is/c++draft/dcl.attr#deprecated-2.sentence-1

Should we follow suite? Arguably, it would be of limited usefulness.

@shafik shafik added the confirmed Verified by a second party label Apr 25, 2024
@shafik
Copy link
Collaborator

shafik commented Apr 25, 2024

Confirmed, seems like it has limited use but this at least documents we are aware of it.

@erichkeane
Copy link
Collaborator

I don't really see the usefulness, but I DEFINITELY think we should enforce it if we are going to permit it on local variable decls. At the moment, the the standard permits them on local variable decls, AND encourages enforcement, so we should.

However, if the response to cplusplus/CWG#530 results in disallowing 'local variables', that would be a valid solution ot this as well.

@cor3ntin cor3ntin changed the title [[deprercated]] applied to local variables [[deprecated]] applied to local variables Apr 25, 2024
@shafik
Copy link
Collaborator

shafik commented Apr 26, 2024

Note, if we remove the [[deprecated]] from f we warn for a now: https://compiler-explorer.com/z/f7o7Wc6W7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party
Projects
None yet
4 participants