summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/conditional-expr.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-01-14 02:53:34 +0000
committerSteve Naroff <snaroff@apple.com>2008-01-14 02:53:34 +0000
commit090353191c2c8ae14e1ff37bb45bc03e413f5672 (patch)
treedbbfd31c5dba05407005a7ce252fca89021c6b8b /clang/test/Sema/conditional-expr.c
parentb9293c51bdd34ed58eca757bf170c6ec0559cbdf (diff)
downloadbcm5719-llvm-090353191c2c8ae14e1ff37bb45bc03e413f5672.tar.gz
bcm5719-llvm-090353191c2c8ae14e1ff37bb45bc03e413f5672.zip
Rewrite Expr::isNullPointerConstant() to deal with multiple levels of explicit casts.
Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0" llvm-svn: 45951
Diffstat (limited to 'clang/test/Sema/conditional-expr.c')
-rw-r--r--clang/test/Sema/conditional-expr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/test/Sema/conditional-expr.c b/clang/test/Sema/conditional-expr.c
index 87fe2d2ed66..24e71153f19 100644
--- a/clang/test/Sema/conditional-expr.c
+++ b/clang/test/Sema/conditional-expr.c
@@ -1,17 +1,21 @@
// RUN: clang -fsyntax-only -verify -pedantic %s
void foo() {
*(0 ? (double *)0 : (void *)0) = 0;
- *((void *) 0) = 0; // -expected-error {{incomplete type 'void' is not assignable}}
+ *(0 ? (double *)0 : (void *)(int *)0) = 0;
+ *(0 ? (double *)0 : (void *)(double *)0) = 0;
+ *(0 ? (double *)0 : (int *)(void *)0) = 0; // expected-warning {{pointer type mismatch ('double *' and 'int *')}}
+ *(0 ? (double *)0 : (double *)(void *)0) = 0;
+ *((void *) 0) = 0; // 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 *'}}
+ 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 *'}}
+ ip = 0 ? (double *)0 : (void *)0; // expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
}
OpenPOWER on IntegriCloud