]>
git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/test/SemaCXX/attr-noreturn.cpp
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Reachability tests have to come first because they get suppressed
4 // if any errors have occurred.
7 __attribute__((noreturn
)) void fail();
13 } // expected-warning {{control reaches end of non-void function}}
21 void f0() __attribute__((__noreturn__
));
25 // Taking the address of a noreturn function
28 void (*fp1
)() __attribute__((noreturn
)) = f0
;
31 // Taking the address of an overloaded noreturn function
32 void f0(int) __attribute__((__noreturn__
));
36 void (*fp1
)() __attribute__((noreturn
)) = f0
;
39 // No-returned function pointers
40 typedef void (* noreturn_fp
)() __attribute__((noreturn
));
42 void f3(noreturn_fp
); // expected-note{{candidate function}}
46 f3(f2
); // expected-error{{no matching function for call}}
51 int blah() __attribute__((noreturn
));
55 return 3; // expected-warning {{function 'blah' declared 'noreturn' should not return}}
62 void foo() __attribute__((__noreturn__
));
69 void bar() __attribute__((__noreturn__
));
76 void baz() __attribute__((__noreturn__
));
77 typedef void voidfn();
80 template<typename
> void wibble() __attribute__((__noreturn__
));
81 template<typename
> voidfn wibble
;