Debian Codegraph @

gcc/testsuite/g++.dg/eh/template1.C

raw
1 // Test whether exception specifier dependent on template parameter
2 // is accepted during template decl processing.
3 // { dg-do run }
4
5 extern "C" void abort();
6
7 class A {};
8
9 template <class T>
10 struct B
11 {
12 typedef A E;
13 };
14
15 template <class T>
16 struct C
17 {
18 typedef B<T> D;
19 typedef typename D::E E;
20 void f()
21 #if __cplusplus <= 201402L
22 throw(E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
23 #endif
24 { throw E(); }
25 };
26
27 int main()
28 {
29 int caught = 0;
30 try
31 {
32 C<int> x;
33 x.f();
34 }
35 catch (A)
36 {
37 ++caught;
38 }
39 if (caught != 1)
40 abort ();
41 return 0;
42 }