<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 - Spurious -Wreturn-type warning with "pathological" for"
href="https://bugs.llvm.org/show_bug.cgi?id=39026">39026</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Spurious -Wreturn-type warning with "pathological" for
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matthew.woehlke@kitware.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Consider the following code:
int foo()
{
for (int y = 0; !y;)
for (/*decl*/; !y; ++y)
return 1;
}
This generates a -Wreturn-type warning, despite that the inner loop body will
*always* execute. Moreover, with optimization enabled, the compiler does (as
expected) successfully remove the loops entirely.
(This is a simplified version of a pre-C++17 `with` statement. The purpose of
this code, which is usually a macro, is to look like the opening statement of a
block, where `/*decl*/` — omitted in this example — is in scope only until the
end of the block. FWIW, the C++17 form, `if (/*decl*/; true)` does not exhibit
the problem.)</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>