r315614 - [Sema] Diagnose tautological comparison with type's min/max values

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 10 10:14:10 PST 2017

On Thu, Oct 12, 2017 at 2:33 PM, Roman Lebedev via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> On Fri, Oct 13, 2017 at 12:12 AM, Nico Weber <thakis at chromium.org> wrote:
>> Huh, I consider clang not warning on this a feature, not a bug. Why are we
>> trying to match what gcc does here?
> Because i have been bitten by this more than once.
> It did result in big amount of wasted time, and this "thread":
> https://lists.llvm.org/pipermail/llvm-dev/2017-August/116390.html
> As with all the clang diagnostics, you can disable them
> I personally don't have any opinion on comparisons with
> std::numeric_limits<...>::{min,max}()

To disable the new warning but keep the ones we used to have enabled,
we now need to pass -Wno-tautological-constant-compare
-Wtautological-constant-out-of-range-compare, which is quite a
mouthful. It would perhaps be better if the new warning could have
been behind a flag that could be disabled separately.

More information about the cfe-commits mailing list