summaryrefslogtreecommitdiffstats
path: root/test/Sema/compare.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committered <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitf27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /test/Sema/compare.c
downloadFreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip
FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz
Import Clang, at r72732.
Diffstat (limited to 'test/Sema/compare.c')
-rw-r--r--test/Sema/compare.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
new file mode 100644
index 0000000..4b44bf5
--- /dev/null
+++ b/test/Sema/compare.c
@@ -0,0 +1,17 @@
+// RUN: clang-cc -fsyntax-only -pedantic -verify %s
+
+int test(char *C) { // nothing here should warn.
+ return C != ((void*)0);
+ return C != (void*)0;
+ return C != 0;
+}
+
+int equal(char *a, const char *b)
+{
+ return a == b;
+}
+
+int arrays(char (*a)[5], char(*b)[10], char(*c)[5]) {
+ int d = (a == c);
+ return a == b; // expected-warning {{comparison of distinct pointer types}}
+}
OpenPOWER on IntegriCloud