summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/eh/template1.C
blob: 2cbf9c698b081bb7ae75eeeca52abccea6495f14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Test whether exception specifier dependent on template parameter
// is accepted during template decl processing.
// { dg-do run }

extern "C" void abort();

class A {};

template <class T>
struct B
{
  typedef A E;
};

template <class T>
struct C
{
  typedef B<T> D;
  typedef typename D::E E;
  void f() throw(E) { throw E(); }
};

int main()
{
  int caught = 0;
  try
    {
      C<int> x;
      x.f();
    }
  catch (A)
    {
      ++caught;
    }
  if (caught != 1)
    abort ();
  return 0;
}