gcc/testsuite/g++.dg/lto/20081109_0.C
raw| 1 | // Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'. |
| 2 | |
| 3 | extern "C" { void abort (void);} |
| 4 | int foo (int); |
| 5 | |
| 6 | class A |
| 7 | { |
| 8 | int x; |
| 9 | |
| 10 | public: |
| 11 | A() { x = 2304; } |
| 12 | ~A() { if (x != 2305) abort (); } |
| 13 | void inc () { x++; } |
| 14 | }; |
| 15 | |
| 16 | |
| 17 | int main() |
| 18 | { |
| 19 | A x; |
| 20 | x.inc(); |
| 21 | try |
| 22 | { |
| 23 | foo (0); |
| 24 | abort (); // Should not execute |
| 25 | } |
| 26 | catch (int e) |
| 27 | { |
| 28 | return 0; |
| 29 | } |
| 30 | } |