aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/compare.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2012-11-16 01:32:40 +0000
committerRichard Trieu <rtrieu@google.com>2012-11-16 01:32:40 +0000
commit8f50b24c8b17368f68c2e71240d487dde53f6da8 (patch)
tree84e635c1abb8d399a11e512e4ebf8eee7a484ad3 /test/SemaCXX/compare.cpp
parent0bbf1c668e8cb1a3e5b1385c2fd5cd6c73f481c0 (diff)
Take into account the zero sign bit for positive numbers when computing the bit
width of an enum with negative values in IntRange. Include a test for -Wtautological-constant-out-of-range-compare where this had manifested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/compare.cpp')
-rw-r--r--test/SemaCXX/compare.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp
index 05980baf6d..c76efe92ba 100644
--- a/test/SemaCXX/compare.cpp
+++ b/test/SemaCXX/compare.cpp
@@ -338,3 +338,13 @@ void test7(unsigned long other) {
(void)((unsigned char)other != (unsigned short)(0x100)); // expected-warning{{true}}
(void)((unsigned short)other != (unsigned char)(0xff));
}
+
+void test8(int x) {
+ enum E {
+ Negative = -1,
+ Positive = 1
+ };
+
+ (void)((E)x == 1);
+ (void)((E)x == -1);
+}