aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/conditional-expr.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-01-08 01:11:38 +0000
committerSteve Naroff <snaroff@apple.com>2008-01-08 01:11:38 +0000
commitb6d54e56a5c65c2728080578b84374c3c594daec (patch)
treedc31778c027de45052d3dc61f3ddd6599565fc49 /test/Sema/conditional-expr.c
parent3f51a20208ddb0dd4ae0495832c1872cb1efe021 (diff)
Fix Sema::CheckConditionalOperands(). The null pointer constant checks need to precede the check for two pointer operands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/conditional-expr.c')
-rw-r--r--test/Sema/conditional-expr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c
new file mode 100644
index 0000000000..f6b9d1f42d
--- /dev/null
+++ b/test/Sema/conditional-expr.c
@@ -0,0 +1,17 @@
+// RUN: clang -fsyntax-only -verify -pedantic %s
+void foo() {
+ *(0 ? (double *)0 : (void *)0) = 0;
+ *((void *) 0) = 0; // -expected-warning {{dereferencing void pointer}} -expected-error {{incomplete type 'void' is not assignable}}
+ double *dp;
+ int *ip;
+ void *vp;
+
+ dp = vp;
+ vp = dp;
+ ip = dp; // -expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
+ dp = ip; // -expected-warning {{incompatible pointer types assigning 'int *', expected 'double *'}}
+ dp = 0 ? (double *)0 : (void *)0;
+ vp = 0 ? (double *)0 : (void *)0;
+ ip = 0 ? (double *)0 : (void *)0; // -expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
+}
+