summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/compare.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-11-05 17:18:09 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-11-05 17:18:09 +0000
commitb3a51061b1b9c4add078237850649f7c9efb13ab (patch)
tree8b316eca843681b024034db1125707173b9adb4a /test/SemaCXX/compare.cpp
parentb6d5e15aae202f157c6cd63da8fa4b089e7b31e9 (diff)
downloadFreeBSD-src-b3a51061b1b9c4add078237850649f7c9efb13ab.zip
FreeBSD-src-b3a51061b1b9c4add078237850649f7c9efb13ab.tar.gz
Update clang to r86140.
Diffstat (limited to 'test/SemaCXX/compare.cpp')
-rw-r--r--test/SemaCXX/compare.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp
new file mode 100644
index 0000000..806b078
--- /dev/null
+++ b/test/SemaCXX/compare.cpp
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+
+int test0(long a, unsigned long b) {
+ enum Enum {B};
+ return (a == B) + // expected-warning {{comparison of integers of different signs}}
+ ((int)a == B) + // expected-warning {{comparison of integers of different signs}}
+ ((short)a == B) + // expected-warning {{comparison of integers of different signs}}
+ (a == (unsigned int) B) + // expected-warning {{comparison of integers of different signs}}
+ (a == (unsigned short) B); // expected-warning {{comparison of integers of different signs}}
+
+ // Should be able to prove all of these are non-negative.
+ return (b == (long) B) +
+ (b == (int) B) +
+ (b == (short) B);
+}
OpenPOWER on IntegriCloud