https://bugs.llvm.org/show_bug.cgi?id=35009
Bug ID: 35009
Summary: -Wtautological-constant-compare warning misleading on
enum type
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: mattias.v.eriks...@ericsson.com
CC: llvm-bugs@lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs