-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzergood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributelambdaC++11 lambda expressionsC++11 lambda expressions
Description
| Bugzilla Link | 46714 |
| Version | trunk |
| OS | Linux |
| CC | @dwblaikie,@zygoloid |
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,
$cat test.cc
int main(){
auto var = [](auto){};
return 0;
}$clang++ -std=c++11 -c test.cc
test.cc:2:19: error: 'auto' not allowed in lambda parameter
auto var = [](auto){};
^~~~
1 error generated.
I guess clang should give a more specific diagnostic about this like GCC.
$g++ -std=c++11 -c test.cc
test.cc: In function ‘int main()’:
test.cc:2:19: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
2 | auto var = [](auto){};
| ^~~~
Just a small enhancement I guess, please understand if anything I stated is unsuitable.
Thanks,
Haoxin
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzergood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributelambdaC++11 lambda expressionsC++11 lambda expressions