brintos

brintos / llvm-project-archived public Read only

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