blob: 34a56e41f876a899d0eb90177ae5a4d83798baa0 (
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
|
// { dg-do run }
// Testcase for proper handling of rethrow.
#include <stdio.h>
int c, d;
struct A
{
int i;
A () { i = ++c; printf ("A() %d\n", i); }
A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
~A() { printf ("~A() %d\n", i); ++d; }
};
int
main ()
{
try
{
try
{
printf ("Throwing 1...\n");
throw A();
}
catch (A)
{
try
{
printf ("Throwing 2...\n");
throw;
}
catch (A)
{
printf ("Falling out...\n");
}
}
}
catch (A)
{
printf ("Caught.\n");
}
printf ("c == %d, d == %d\n", c, d);
return c != d;
}
|