summaryrefslogtreecommitdiff
path: root/clang/test/Parser/pointer_promotion.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Parser/pointer_promotion.c')
-rw-r--r--clang/test/Parser/pointer_promotion.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Parser/pointer_promotion.c b/clang/test/Parser/pointer_promotion.c
new file mode 100644
index 0000000..30589d0
--- /dev/null
+++ b/clang/test/Parser/pointer_promotion.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void test() {
+ void *vp;
+ int *ip;
+ char *cp;
+ struct foo *fp;
+ struct bar *bp;
+ short sint = 7;
+
+ if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
+ if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
+ if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
+ if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
+ if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('int' and 'int *')}}
+ if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
+}