-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Diagnostic enhancement: "auto" in lambda expression under -std=c++11 #46059
Comments
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
For more instructions on how to submit a patch to LLVM, see our documentation. If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue. @llvm/issue-subscribers-good-first-issue |
Looks like a reasonable ask https://godbolt.org/z/d7aT6arnx |
@cor3ntin can you point out where this diagnostic is defined in sources? I haven't been able to find it. |
The code which determines there is an error is here The error is produced a bit below A solution might be to keep track of when the errors are conditioned on language versions, and modify the existing diagnostic to add "before C++20" |
llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td Lines 2345 to 2360 in fa2b038
I've tried to get through this even before writing my previous comment, but I wasn't able to recognize the message, and find it hard still. |
… C++14 (llvm#46059) Namely, we specify that `auto` in a lambda parameter is a C++14 extension in the error message, which now reads: `'auto' not allowed in lambda parameter until C++14` This does not change the behavior for `decltype(auto)` and `__auto_type` though. The relevant change to `SemaType.cpp` is the addition of a branch that sets `Error = 24`, whilst the bulk of the change comes from formatting.
… C++14 (#46059) (#68540) Namely, we specify that `auto` in a lambda parameter is a C++14 extension in the error message, which now reads: `'auto' not allowed in lambda parameter before C++14` This does not change the behavior for `decltype(auto)` and `__auto_type` though. --------- Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Extended Description
Hi, all.
"auto" used in lambda expression is a c++14 extension, but clang doesn't emit the appropriate diagnostic message about it.
For example,
I guess clang should give a more specific diagnostic about this like GCC.
Just a small enhancement I guess, please understand if anything I stated is unsuitable.
Thanks,
Haoxin
The text was updated successfully, but these errors were encountered: