summaryrefslogtreecommitdiffstats
path: root/clang/test
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
commit08b5fef122e899179c12c05792cd48dc36e2d319 (patch)
treeec504b5f0f49ea8b1b0a508b430f3cff7dc59903 /clang/test
parentc08fa185961a38a1d972ccc7267206d0382f81f3 (diff)
downloadbcm5719-llvm-08b5fef122e899179c12c05792cd48dc36e2d319.tar.gz
bcm5719-llvm-08b5fef122e899179c12c05792cd48dc36e2d319.zip
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. llvm-svn: 168126
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/compare.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/compare.cpp b/clang/test/SemaCXX/compare.cpp
index 05980baf6d6..c76efe92baf 100644
--- a/clang/test/SemaCXX/compare.cpp
+++ b/clang/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);
+}
OpenPOWER on IntegriCloud