gcc/testsuite/g++.dg/torture/pr91355.C
raw| 1 | // PR tree-optimization/91355 |
| 2 | // { dg-do run } |
| 3 | // { dg-options "-std=c++14" } |
| 4 | |
| 5 | unsigned int d = 0; |
| 6 | |
| 7 | struct S { |
| 8 | S () { d++; } |
| 9 | S (const S &) { d++; } |
| 10 | ~S () { d--; } |
| 11 | }; |
| 12 | |
| 13 | void |
| 14 | foo (int i) throw (int) // { dg-warning "dynamic exception specifications are deprecated" } |
| 15 | { |
| 16 | if (i == 0) |
| 17 | throw 3; |
| 18 | S d; |
| 19 | throw 3; |
| 20 | } |
| 21 | |
| 22 | int |
| 23 | main () |
| 24 | { |
| 25 | try { foo (1); } catch (...) {} |
| 26 | if (d) |
| 27 | __builtin_abort (); |
| 28 | } |