[llvm-bugs] [Bug 49665] New: `-Wfor-loop-analysis` false positive when variable is modified in lambda in function template
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Mar 20 17:50:26 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49665
Bug ID: 49665
Summary: `-Wfor-loop-analysis` false positive when variable is
modified in lambda in function template
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: david at doublewise.net
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
The following code
```
template<typename>
void f() {
for (int x = 0; x != 1; ) {
[&]{ ++x; }();
}
}
```
when compiled with `-Wfor-loop-analysis` incorrectly warns
```
<source>:3:18: warning: variable 'x' used in loop condition not modified in
loop body [-Wfor-loop-analysis]
for (int x = 0; x != 1; ) {
^
1 warning generated.
Compiler returned: 0
```
See it live: https://godbolt.org/z/s6KPdY
--
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/20210321/217f44a4/attachment.html>
More information about the llvm-bugs
mailing list