summaryrefslogtreecommitdiff
path: root/test/Sema/incompatible-function-pointer-types.c
blob: f0f594f8db8418109b3a43b6e62aa5b2d3b90e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-pointer-types -verify
// RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-function-pointer-types -verify

// This test ensures that the subgroup of -Wincompatible-pointer-types warnings
// that concern function pointers can be promoted (or not promoted) to an error
// *separately* from the other -Wincompatible-pointer-type warnings.
typedef int (*MyFnTyA)(int *, char *);

int bar(char *a, int *b) { return 0; }
int foo(MyFnTyA x) { return 0; } // expected-note {{passing argument to parameter 'x' here}}

void baz() {
  foo(&bar); // expected-warning {{incompatible function pointer types passing 'int (*)(char *, int *)' to parameter of type 'MyFnTyA' (aka 'int (*)(int *, char *)')}}
}