First pass at implementing C++ enum semantics: calculate (and store) an
"integer promotion" type associated with an enum decl, and use this type to
determine which type to promote to. This type obeys C++ [conv.prom]p2 and
is therefore generally signed unless the range of the enumerators forces
it to be unsigned.
Kills off a lot of false positives from -Wsign-compare in C++, addressing
rdar://7455616
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90965 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 01a216f..fa2d3a0 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -225,3 +225,8 @@
return foo == (void*) 0;
return foo == (void*) 1;
}
+
+int test1(int i) {
+ enum en { zero };
+ return i > zero;
+}