| 1 |
/* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify |
| 2 |
*/ |
| 3 |
struct incomplete; // expected-note{{forward declaration of 'struct incomplete'}} |
| 4 |
|
| 5 |
int sub1(int *a, double *b) { |
| 6 |
return a - b; /* expected-error{{not pointers to compatible types}} */ |
| 7 |
} |
| 8 |
|
| 9 |
void *sub2(struct incomplete *P) { |
| 10 |
return P-4; /* expected-error{{arithmetic on a pointer to an incomplete type 'struct incomplete'}} */ |
| 11 |
} |
| 12 |
|
| 13 |
void *sub3(void *P) { |
| 14 |
return P-4; /* expected-warning{{arithmetic on a pointer to void is a GNU extension}} */ |
| 15 |
} |
| 16 |
|
| 17 |
int sub4(void *P, void *Q) { |
| 18 |
return P-Q; /* expected-warning{{arithmetic on pointers to void is a GNU extension}} */ |
| 19 |
} |
| 20 |
|
| 21 |
int sub5(void *P, int *Q) { |
| 22 |
return P-Q; /* expected-error{{not pointers to compatible types}} */ |
| 23 |
} |
| 24 |
|
| 25 |
int logicaland1(int a) { |
| 26 |
return a && (void)a; /* expected-error{{invalid operands}} */ |
| 27 |
} |