<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - no warning for bool compared to out-of-range constant"
href="http://llvm.org/bugs/show_bug.cgi?id=15489">15489</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>no warning for bool compared to out-of-range constant
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>b.r.longbons@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Clang does not warn (even with -Weverything) for the comparison of a boolean to
a constant integer with a value other than 0 or 1.
This should be covered by -Wtautological-compare at least, or maybe even
enabled by default.
This is a subset of the RFE in <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - RFE: Implement warning on integer comparison with bool"
href="show_bug.cgi?id=7866">bug #7866</a>, but should be enabled separately
since this is probably ALWAYS a bug, whereas that one might be legitimate in
old code.
Sample code:
bool check1(bool v)
{
return v == -1;
}
bool check2(struct Foo *p)
{
return !p == -1; // evil half-refactoring ...
}</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>