-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Open
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 analyzerconfirmedVerified by a second partyVerified by a second partyfalse-positiveWarning fires when it should notWarning fires when it should notlambdaC++11 lambda expressionsC++11 lambda expressions
Description
| Bugzilla Link | 36880 |
| Version | trunk |
| OS | All |
| CC | @CaseyCarter,@elvenfighter,@rogerorr |
Extended Description
$ cat test.cpp
template<class T>
struct DummyTemplate {
template<class T2>
void methodTemplate(const T2&){}
void ToTemplate(const int& param){
[this](const auto& p){methodTemplate(p);}(param);
}
};
int main()
{
int i{};
DummyTemplate<bool> dt;
dt.ToTemplate(i);
}$ clang test.cpp -std=c++14 -Wunused-lambda-capture
test.cpp:7:10: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
[this](const auto& p){methodTemplate(p);}(param);
^
test.cpp:15:8: note: in instantiation of member function 'DummyTemplate<bool>::ToTemplate' requested here
dt.ToTemplate(i);
^
1 warning generated.Reactions are currently unavailable
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 analyzerconfirmedVerified by a second partyVerified by a second partyfalse-positiveWarning fires when it should notWarning fires when it should notlambdaC++11 lambda expressionsC++11 lambda expressions