| 1 |
// RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-pointer-types -verify=hard,expected |
| 2 |
// RUN: %clang_cc1 -fsyntax-only %s -Wno-error=incompatible-pointer-types -verify=soft,expected |
| 3 |
// RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-function-pointer-types -verify=hard,expected |
| 4 |
// RUN: %clang_cc1 -fsyntax-only %s -Wno-error=incompatible-function-pointer-types -verify=soft,expected |
| 5 |
|
| 6 |
// This test ensures that the subgroup of -Wincompatible-pointer-types warnings |
| 7 |
// that concern function pointers can be promoted (or not promoted) to an error |
| 8 |
// *separately* from the other -Wincompatible-pointer-type warnings. |
| 9 |
typedef int (*MyFnTyA)(int *, char *); |
| 10 |
|
| 11 |
int bar(char *a, int *b) { return 0; } |
| 12 |
int foo(MyFnTyA x) { return 0; } // expected-note {{passing argument to parameter 'x' here}} |
| 13 |
|
| 14 |
void baz(void) { |
| 15 |
foo(&bar); // soft-warning {{incompatible function pointer types passing 'int (*)(char *, int *)' to parameter of type 'MyFnTyA' (aka 'int (*)(int *, char *)')}} \ |
| 16 |
hard-error {{incompatible function pointer types passing 'int (*)(char *, int *)' to parameter of type 'MyFnTyA' (aka 'int (*)(int *, char *)')}} |
| 17 |
} |