[llvm-bugs] [Bug 39285] New: Structured binding confuses -Wfor-loop-analysis
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 14 02:26:10 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39285
Bug ID: 39285
Summary: Structured binding confuses -Wfor-loop-analysis
Product: new-bugs
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: namark at disroot.org
CC: llvm-bugs at lists.llvm.org
This code
#include <cstdio>
#include <tuple>
int main()
{
const int n = 10;
for
(
auto [i, j] = std::tuple(0, 1);
i < n;
++i, ++j
)
{}
}
compiled with "-std=c++17 -Wfor-loop-analysis" options produces a warning:
<source>:9:13: warning: variable 'n' used in loop condition not modified in
loop body [-Wfor-loop-analysis]
i < n;
^
The problem seems to be caused by the use of structured binding in the for
loop.
I'm using clang version 7.0.0-svn341916-1~exp1~20180911120702.28
(branches/release_70),
but it also reproduces with clang 5/6/7/trunk on godbolt.org.
--
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/20181014/01032f1d/attachment.html>
More information about the llvm-bugs
mailing list