blob: 9b14f011153231139f81017aded039ab4904457a (
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
|
// { dg-do run }
// Bug: g++ fails to treat function-try-blocks in ctors specially.
// Submitted by Jason Merrill <jason@cygnus.com>
int c;
int r;
struct A {
int i;
A(int j) { i = j; }
~A() { c += i; }
};
struct B: public A {
A a;
B() try : A(1), a(2)
{ throw 1; }
catch (...)
{ if (c != 3) r |= 1; }
};
int main ()
{
try
{ B b; }
catch (...)
{ c = 0; }
if (c != 0) r |= 2;
return r;
}
|