Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / incompatible-function-pointer-types-strict.c
blob647251de420307cf76ca89c8aa45d03bd1dbcbe2
1 // RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-function-pointer-types-strict -verify=soft,strict
2 // RUN: %clang_cc1 -fsyntax-only %s -Werror=incompatible-function-pointer-types-strict -verify=hard,strict
3 // RUN: %clang_cc1 -fsyntax-only %s -Wincompatible-function-pointer-types -verify=nonstrict
4 // nonstrict-no-diagnostics
6 enum E { A = -1, B };
7 typedef enum E (*fn_a_t)(void);
8 typedef void (*fn_b_t)(void);
10 int a(void) { return 0; }
11 void __attribute__((noreturn)) b(void) { while (1); }
13 void fa(fn_a_t x) {} // strict-note {{passing argument to parameter 'x' here}}
14 void fb(fn_b_t x) {}
16 void baz(void) {
17 fa(&a); // soft-warning {{incompatible function pointer types passing 'int (*)(void)' to parameter of type 'fn_a_t' (aka 'enum E (*)(void)')}} \
18 hard-error {{incompatible function pointer types passing 'int (*)(void)' to parameter of type 'fn_a_t' (aka 'enum E (*)(void)')}}
19 fb(&b); // no-warning