| 1 |
// PR c++/59255 |
| 2 |
// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'. |
| 3 |
// { dg-options "-std=c++11 -O2" } |
| 4 |
|
| 5 |
struct S |
| 6 |
{ |
| 7 |
__attribute__((noinline, noclone)) ~S () noexcept (true) |
| 8 |
{ |
| 9 |
if (fn) |
| 10 |
fn (1); |
| 11 |
} |
| 12 |
void (*fn) (int); |
| 13 |
}; |
| 14 |
|
| 15 |
__attribute__((noinline, noclone)) void |
| 16 |
foo (int x) |
| 17 |
{ |
| 18 |
if (x != 1) |
| 19 |
throw 1; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
for (int i = 0; i < 100; i++) |
| 26 |
{ |
| 27 |
S s; |
| 28 |
s.fn = foo; |
| 29 |
} |
| 30 |
} |