<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Structured binding confuses -Wfor-loop-analysis"
href="https://bugs.llvm.org/show_bug.cgi?id=39285">39285</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Structured binding confuses -Wfor-loop-analysis
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>namark@disroot.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>