blob: 950fadc83055c91548da80565e093a0f7613eaaa [file] [log] [blame]
Anna Zaks67221552011-07-28 19:51:27 +00001// 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
6void ip(int *aPtr) {} // expected-note{{passing argument to parameter 'aPtr' here}}
7void i(int a) {} // expected-note{{passing argument to parameter 'a' here}}
8void ii(int a) {} // expected-note{{passing argument to parameter 'a' here}}
9void fp(float *aPtr) {} // expected-note{{passing argument to parameter 'aPtr' here}}
10void f(float a) {} // expected-note{{passing argument to parameter 'a' here}}
11
12void 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}