1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | // RUN: cp %s %t |
3 | // RUN: not %clang_cc1 -fsyntax-only -fixit -x c %t |
4 | // RUN: %clang_cc1 -fsyntax-only -pedantic -x c %t |
5 | |
6 | void ip(int *aPtr) {} // expected-note{{passing argument to parameter 'aPtr' here}} |
7 | void i(int a) {} // expected-note{{passing argument to parameter 'a' here}} |
8 | void ii(int a) {} // expected-note{{passing argument to parameter 'a' here}} |
9 | void fp(float *aPtr) {} // expected-note{{passing argument to parameter 'aPtr' here}} |
10 | void f(float a) {} // expected-note{{passing argument to parameter 'a' here}} |
11 | |
12 | void f2(int *aPtr, int a, float *bPtr, char c) { |
13 | float fl = 0; |
14 | ip(a); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'; take the address with &}} |
15 | i(aPtr); // expected-warning{{incompatible pointer to integer conversion passing 'int *' to parameter of type 'int'; dereference with *}} |
16 | ii(&a); // expected-warning{{incompatible pointer to integer conversion passing 'int *' to parameter of type 'int'; remove &}} |
17 | fp(*bPtr); // expected-error{{passing 'float' to parameter of incompatible type 'float *'; remove *}} |
18 | f(bPtr); // expected-error{{passing 'float *' to parameter of incompatible type 'float'; dereference with *}} |
19 | a = aPtr; // expected-warning{{incompatible pointer to integer conversion assigning to 'int' from 'int *'; dereference with *}} |
20 | fl = bPtr + a; // expected-error{{assigning to 'float' from incompatible type 'float *'; dereference with *}} |
21 | bPtr = bPtr[a]; // expected-error{{assigning to 'float *' from incompatible type 'float'; take the address with &}} |
22 | } |
23 | |