Merge from mainline
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / ice990323-2.C
blobcefef775062aedb2648179bfd294cf026a47ee33
1 // { dg-do run  }
2 // check EH with templates
3 extern "C" void abort ();
4 extern "C" void exit (int);
6 template <class T, int n, class U> struct A {
7         A() {}
8         A(const char*) {}
9 };
11 void f1()
13         throw *(new A<double, 47, A<int, 37, short> >);
16 void f2()
18         throw *(new A<double, 47, A<int, 36, short> >);
21 void f3()
23         throw A<double, 47, A<int, 37, short> > ("howdy");
26 void f4()
28         throw A<double, 47, A<int, 36, short> > ("hi michey");
31 int main()
33         int flag;
35         flag = 0;
36         try {
37                 f1();
38         }
39         catch (A<double, 47, A<int, 36, short> >) {
40                 abort();
41         }
42         catch (A<double, 47, A<int, 37, short> >) {
43                 flag = 1;
44         }
45         if (!flag)
46                 abort();
48         flag = 0;
49         try {
50                 f2();
51         }
52         catch (A<double, 47, A<int, 36, short&> >) {
53                 abort();
54         }
55         catch (A<double, 47, A<int, 36, short> >) {
56                 flag = 1;
57         }
58         if (!flag)
59                 abort();
61         flag = 0;
62         try {
63                 f3();
64         }
65         catch (A<double, 47, A<int, 36, short> >) {
66                 abort();
67         }
68         catch (A<double, 47, A<int, 37, short> >) {
69                 flag = 1;
70         }
71         if (!flag)
72                 abort();
74         flag = 0;
75         try {
76                 f4();
77         }
78         catch (A<double, 47, A<int, 36, short&> >) {
79                 abort();
80         }
81         catch (A<double, 47, A<int, 36, short> >) {
82                 flag = 1;
83         }
84         if (!flag)
85                 abort();
87         exit(0);