<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt">On Mon, Nov 12, 2012 at 11:22 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Comments below.<br>
<div><div class="h5"><br>
On Mon, Nov 12, 2012 at 9:46 AM, Richard Trieu <<a href="mailto:rtrieu@google.com">rtrieu@google.com</a>> wrote:<br>
> Make -Wtautological-constant-out-of-range-compare checking take into account types and conversion between types.  The old version merely checked the bit widths, which allowed failed to catch a few cases, while warning on other safe comparisons.<br>

><br>
> <a href="http://llvm-reviews.chandlerc.com/D113" target="_blank">http://llvm-reviews.chandlerc.com/D113</a><br>
><br>
> Files:<br>
>   test/Analysis/additive-folding.cpp<br>
>   test/SemaCXX/compare.cpp<br>
>   test/SemaCXX/warn-enum-compare.cpp<br>
>   lib/Sema/SemaChecking.cpp<br>
<br>
</div></div>Index: test/SemaCXX/warn-enum-compare.cpp<br>
===================================================================<br>
--- test/SemaCXX/warn-enum-compare.cpp<br>
+++ test/SemaCXX/warn-enum-compare.cpp<br>
@@ -39,8 +39,8 @@<br>
   while (b == c);<br>
   while (B1 == name1::B2);<br>
   while (B2 == name2::B1);<br>
-  while (x == AnonAA); // expected-warning {{comparison of constant<br>
42 with expression of type 'Foo' is always false}}<br>
-  while (AnonBB == y); // expected-warning {{comparison of constant<br>
45 with expression of type 'Bar' is always false}}<br>
+  while (x == AnonAA);<br>
+  while (AnonBB == y);<br>
   while (AnonAA == AnonAB);<br>
   while (AnonAB == AnonBA);<br>
   while (AnonBB == AnonAA);<br>
<br>
Why are you changing this warning?<br></blockquote><div><br></div><div>Because it is valid to do:</div><div>x = (Foo)42;</div><div>which makes the condition true.</div><div><br></div><div>I'll be working on a patch to answer the rest of your comments.</div>
</div></div>