[llvm-bugs] [Bug 38954] New: ExprMutationAnalyzer mishandles templated callback lambdas
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 14 23:28:06 PDT 2018
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: dcoughlin at apple.com
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180915/4d5104ef/attachment.html>
More information about the llvm-bugs
mailing list