<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 - Undesirable -Wrange-loop-analysis warning with auto and vector<bool>"
href="https://bugs.llvm.org/show_bug.cgi?id=37392">37392</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Undesirable -Wrange-loop-analysis warning with auto and vector<bool>
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>sean@rogue-research.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>In clang 6.0 and trunk (according to godbolt), the following snippet generates
a warning from -Wrange-loop-analysis when building as C++11:
---------------------
#include <vector>
int main()
{
std::vector<bool> vectorBool;
for (auto&& elem : vectorBool)
(void)elem;
}
---------------------
warning: loop variable 'elem' is always a copy because the range of type
'std::vector<bool>' does not return a reference [-Wrange-loop-analysis]
for (auto&& elem : vectorBool)
^
See also: <<a href="https://godbolt.org/g/GQehmY">https://godbolt.org/g/GQehmY</a>>
Others seem to agree that the warning is not helpful:
<<a href="https://stackoverflow.com/questions/50066139/what-is-clangs-range-loop-analysis-diagnostic-about">https://stackoverflow.com/questions/50066139/what-is-clangs-range-loop-analysis-diagnostic-about</a>></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>