Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / instantiate-exception-spec.cpp
blob1f05534e5c0f8e61eb8a3b8439f5c4f8bb746281
1 // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -verify %std_cxx98-14 %s -DERRORS
2 // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -emit-llvm-only %std_cxx98-14 %s
4 #ifdef ERRORS
5 template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'Incomplete' is not allowed in exception specification}}
6 struct Incomplete; // expected-note{{forward}}
8 void test_f1(Incomplete *incomplete_p, int *int_p) {
9 f1(int_p);
10 f1(incomplete_p); // expected-note{{instantiation of}}
12 #endif
14 template<typename T> void f(void (*p)() throw(T)) {
15 #ifdef ERRORS
16 void (*q)() throw(char) = p; // expected-error {{target exception spec}}
18 extern void (*p2)() throw(T);
19 void (*q2)() throw(char) = p2; // expected-error {{target exception spec}}
21 extern void (*p3)() throw(char);
22 void (*q3)() throw(T) = p3; // expected-error {{target exception spec}}
24 void (*q4)() throw(T) = p2; // ok
25 #endif
26 p();
28 void g() { f<int>(0); } // expected-note {{instantiation of}}