https://bugs.llvm.org/show_bug.cgi?id=38954
Bug ID: 38954
Summary: ExprMutationAnalyzer mishandles templated callback
lambdas
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcough...@apple.com
Reporter: lebedev...@gmail.com
CC: llvm-bugs@lists.llvm.org
template<typename Lambda> void withCallback(Lambda l) {
for(int i = 0; i < 4; i++) {
l(i);
}
}
void test() {
auto l = [](int i){};
withCallback(l);
}
warning: variable is mutated in the loop body and loop iteration expression
[bugprone-loop-variable-mutations]
for(int i = 0; i < 4; i++) {
^
note: loop in question
for(int i = 0; i < 4; i++) {
^
note: mutation in loop body occurs here
l(i);
^
note: mutation in loop iteration expression occurs here
for(int i = 0; i < 4; i++) {
^
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs