summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.robertl/ice990323-2.C
blob: cefef775062aedb2648179bfd294cf026a47ee33 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// { dg-do run  }
// check EH with templates
extern "C" void abort ();
extern "C" void exit (int);

template <class T, int n, class U> struct A {
	A() {}
	A(const char*) {}
};

void f1()
{
	throw *(new A<double, 47, A<int, 37, short> >);
}

void f2()
{
	throw *(new A<double, 47, A<int, 36, short> >);
}

void f3()
{
	throw A<double, 47, A<int, 37, short> > ("howdy");
}

void f4()
{
	throw A<double, 47, A<int, 36, short> > ("hi michey");
}

int main()
{
	int flag;

	flag = 0;
	try {
		f1();
	}
	catch (A<double, 47, A<int, 36, short> >) {
		abort();
	}
	catch (A<double, 47, A<int, 37, short> >) {
		flag = 1;
	}
	if (!flag)
		abort();

	flag = 0;
	try {
		f2();
	}
	catch (A<double, 47, A<int, 36, short&> >) {
		abort();
	}
	catch (A<double, 47, A<int, 36, short> >) {
		flag = 1;
	}
	if (!flag)
		abort();

	flag = 0;
	try {
		f3();
	}
	catch (A<double, 47, A<int, 36, short> >) {
		abort();
	}
	catch (A<double, 47, A<int, 37, short> >) {
		flag = 1;
	}
	if (!flag)
		abort();

	flag = 0;
	try {
		f4();
	}
	catch (A<double, 47, A<int, 36, short&> >) {
		abort();
	}
	catch (A<double, 47, A<int, 36, short> >) {
		flag = 1;
	}
	if (!flag)
		abort();

	exit(0);
}