[llvm-bugs] [Bug 46714] New: Diagnostic enhancement: "auto" in lambda expression under -std=c++11
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 14 05:41:10 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46714
Bug ID: 46714
Summary: Diagnostic enhancement: "auto" in lambda expression
under -std=c++11
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: haoxintu at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200714/948fdcd4/attachment.html>
More information about the llvm-bugs
mailing list