[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / clang / test / Sema / initialize-noreturn.c
blobf8ea923268bc42038ea10b1c07f29454489e2916
1 // RUN: %clang_cc1 %s -fsyntax-only -Wno-strict-prototypes -verify
3 typedef void (*Fn_noret)(void) __attribute__((noreturn));
4 typedef void (*Fn_ret)(void);
6 typedef void (*Fn_noret_noproto)() __attribute__((noreturn));
7 typedef void (*Fn_ret_noproto)();
9 void foo(void);
10 void foo_noret(void) __attribute__((noreturn));
12 void foo_noproto();
13 void foo_noret_noproto() __attribute__((noreturn));
15 void test() {
16 Fn_noret fn2 = &foo; // expected-error {{incompatible function pointer types initializing 'Fn_noret'}}
17 Fn_noret fn3 = &foo_noret;
18 Fn_ret fn4 = &foo_noret;
19 Fn_ret fn5 = &foo;
21 Fn_noret_noproto fn6 = &foo_noproto; // expected-error {{incompatible function pointer types initializing 'Fn_noret_noproto'}}
22 Fn_noret_noproto fn7 = &foo_noret_noproto;
23 Fn_ret_noproto fn8 = &foo_noret_noproto;
24 Fn_ret_noproto fn9 = &foo_noproto;