-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
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:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)false-negativeWarning doesn't fire when it shouldWarning doesn't fire when it shouldlambdaC++11 lambda expressionsC++11 lambda expressions
Description
#include <algorithm>
#include <functional>
auto foo(int x) {
return [&]() { return x + 1; }; // good, give a warning.
}
std::function<int()> foo2(int x) {
return [&]() { return x + 1; }; // no warning
}
auto foo3(int x) {
auto a = [&]() { return x + 1;};
return a; // no warning.
}
https://godbolt.org/z/nfacaEfGM, it would be good to detect case 2 and case 3.
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:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)false-negativeWarning doesn't fire when it shouldWarning doesn't fire when it shouldlambdaC++11 lambda expressionsC++11 lambda expressions
Type
Projects
Status
No status