[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Sema / typecheck-binop.c
blobbe52d0bd844478c0ebbf2ddc6b336780f29757a9
1 /* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
2 */
3 struct incomplete; // expected-note{{forward declaration of 'struct incomplete'}}
5 int sub1(int *a, double *b) {
6 return a - b; /* expected-error{{not pointers to compatible types}} */
9 void *sub2(struct incomplete *P) {
10 return P-4; /* expected-error{{arithmetic on a pointer to an incomplete type 'struct incomplete'}} */
13 void *sub3(void *P) {
14 return P-4; /* expected-warning{{arithmetic on a pointer to void is a GNU extension}} */
17 int sub4(void *P, void *Q) {
18 return P-Q; /* expected-warning{{arithmetic on pointers to void is a GNU extension}} */
21 int sub5(void *P, int *Q) {
22 return P-Q; /* expected-error{{not pointers to compatible types}} */
25 int logicaland1(int a) {
26 return a && (void)a; /* expected-error{{invalid operands}} */