| 1 |
// RUN: %clang_cc1 %s -verify -fsyntax-only |
| 2 |
// RUN: %clang_cc1 %s -verify -fsyntax-only -fno-signed-char |
| 3 |
|
| 4 |
int a(int* x); // expected-note{{passing argument to parameter 'x' here}} |
| 5 |
int b(unsigned* y) { return a(y); } // expected-warning {{passing 'unsigned int *' to parameter of type 'int *' converts between pointers to integer types with different sign}} |
| 6 |
|
| 7 |
signed char *plainCharToSignedChar(signed char *arg) { // expected-note{{passing argument to parameter}} |
| 8 |
extern char c; |
| 9 |
signed char *p = &c; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 10 |
struct { signed char *p; } s = { &c }; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 11 |
p = &c; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 12 |
plainCharToSignedChar(&c); // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 13 |
return &c; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 14 |
} |
| 15 |
|
| 16 |
char *unsignedCharToPlainChar(char *arg) { // expected-note{{passing argument to parameter}} |
| 17 |
extern unsigned char uc[]; |
| 18 |
char *p = uc; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 19 |
(void) (char *[]){ [42] = uc }; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 20 |
p = uc; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 21 |
unsignedCharToPlainChar(uc); // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 22 |
return uc; // expected-warning {{converts between pointers to integer types where one is of the unique plain 'char' type and the other is not}} |
| 23 |
} |