[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values
mattias.v.eriksson@ericsson.com via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 20 00:38:40 PDT 2017
materi added a comment.
In https://reviews.llvm.org/D38101#901733, @lebedev.ri wrote:
> In https://reviews.llvm.org/D38101#901709, @materi wrote:
>
> > Hi!
>
>
> Hi.
>
> > After this patch I started to see warnings:
>
> Thank you for the report!
>
> > e.c:8:23: warning: integer constant not in range of enumerated type 'enum E' [-Wassign-enum]
> > enum E {a = 7,} e = 1000;
> > ^
> > e.c:10:12: warning: comparison 'enum E' > 7 is always false [-Wtautological-constant-compare]
> > return e > 7;
> >
> >
> > Isn't the the "always false" message misleading? It's only "always false" if e was initialized with an in-range value. Maybe the tautology check should be on the enum's underlying type instead?
>
> I agree, please open a bug, i'll look into this.
Here it is:
https://bugs.llvm.org/show_bug.cgi?id=35009
Thanks!
Repository:
rL LLVM
https://reviews.llvm.org/D38101
More information about the cfe-commits
mailing list