brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · da57e87 Raw
18 lines · c
1// RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-pointer-types -verify=hard,expected2// RUN: %clang_cc1 -fsyntax-only %s -Wno-error=incompatible-pointer-types -verify=soft,expected3// RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-function-pointer-types -verify=hard,expected4// RUN: %clang_cc1 -fsyntax-only %s -Wno-error=incompatible-function-pointer-types -verify=soft,expected5 6// This test ensures that the subgroup of -Wincompatible-pointer-types warnings7// that concern function pointers can be promoted (or not promoted) to an error8// *separately* from the other -Wincompatible-pointer-type warnings.9typedef int (*MyFnTyA)(int *, char *);10 11int bar(char *a, int *b) { return 0; }12int foo(MyFnTyA x) { return 0; } // expected-note {{passing argument to parameter 'x' here}}13 14void 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}18