conditional-expr.c revision b6d54e56a5c65c2728080578b84374c3c594daec
1b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff// RUN: clang -fsyntax-only -verify -pedantic %s
2b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroffvoid foo() {
3b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  *(0 ? (double *)0 : (void *)0) = 0;
4b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  *((void *) 0) = 0; // -expected-warning {{dereferencing void pointer}} -expected-error {{incomplete type 'void' is not assignable}}
5b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  double *dp;
6b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  int *ip;
7b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  void *vp;
8b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff
9b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  dp = vp;
10b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  vp = dp;
11b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  ip = dp; // -expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
12b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  dp = ip; // -expected-warning {{incompatible pointer types assigning 'int *', expected 'double *'}}
13b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  dp = 0 ? (double *)0 : (void *)0;
14b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  vp = 0 ? (double *)0 : (void *)0;
15b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff  ip = 0 ? (double *)0 : (void *)0; // -expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
16b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff}
17b6d54e56a5c65c2728080578b84374c3c594daecSteve Naroff
18