blob: 12f1ec7a0811e70ea210988458bd868b40938bc7 (
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
|
// { dg-do run }
// Bug: obj gets destroyed twice because the fixups for the return are
// inside its cleanup region.
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#define NOEXCEPT_FALSE noexcept (false)
#else
#define NOEXCEPT_FALSE
#endif
extern "C" int printf (const char *, ...);
int d;
struct myExc { };
struct myExcRaiser {
~myExcRaiser() NOEXCEPT_FALSE { throw myExc(); }
};
struct stackObj {
~stackObj() { ++d; printf ("stackObj::~stackObj()\n"); }
};
int test()
{
myExcRaiser rais;
stackObj obj;
return 0;
}
int main()
{
try {
test();
}
catch (myExc &) {
return d != 1;
}
return 1;
}
|