-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang: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 analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyquality-of-implementation
Description
See: https://godbolt.org/z/MKjzsYb9b
int main() {
int a = 0, b = 0;
auto F = [&a, &b]() {
};
}The output is:
<source>:7:16: warning: lambda capture 'a' is not used [-Wunused-lambda-capture]
7 | auto F = [&a, &b]() {
| ~^~
<source>:7:20: warning: lambda capture 'b' is not used [-Wunused-lambda-capture]
7 | auto F = [&a, &b]() {
| ~~~^
<source>:7:10: warning: unused variable 'F' [-Wunused-variable]
7 | auto F = [&a, &b]() {
| ^- The source range for
&aincludes the comma after it - The source range for
&bincludes both the comma and the whitespace between that and the capture
The second point is especially fun when inserting some useless whitespace:
auto F = [&a,
&b]() {
};Metadata
Metadata
Assignees
Labels
clang: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 analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyquality-of-implementation