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