<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 - -Wtautological-constant-compare warning misleading on enum type"
href="https://bugs.llvm.org/show_bug.cgi?id=35009">35009</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wtautological-constant-compare warning misleading on enum type
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mattias.v.eriksson@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This program:
int foo() {
enum E {a = 7} e = 1000;
return e > 7;
}
Gives a warning when compiled with:
clang -Wtautological-constant-compare ee.c -S
ee.c:3:12: warning: comparison 'enum E' > 7 is always false
[-Wtautological-constant-compare]
return e > 7;
~ ^ ~
The warning is a bit misleading because the comparison is only tautological
when e is assigned a value defined in the enum. Maybe it would make sense to
have the tautology check be on the enum's underlying type.</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>