gcc/testsuite/g++.old-deja/g++.law/except6.C
raw| 1 | // { dg-do assemble } |
| 2 | // { dg-options "-fexceptions" } |
| 3 | // GROUPS passed exceptions |
| 4 | // except file |
| 5 | // From: GUSTAVO%[email protected] |
| 6 | // Date: 15 Dec 1993 09:33:30 +0000 (C) |
| 7 | // Subject: exception handling problem |
| 8 | // Message-ID: <[email protected]> |
| 9 | |
| 10 | struct Exception |
| 11 | { |
| 12 | int v; |
| 13 | Exception(int i) { v = i; }; |
| 14 | }; |
| 15 | |
| 16 | void inc(int &i) |
| 17 | { |
| 18 | try { |
| 19 | if (i == 0) |
| 20 | throw Exception(i); |
| 21 | else |
| 22 | i++; |
| 23 | } |
| 24 | catch (Exception v) { |
| 25 | i = v.v; |
| 26 | } |
| 27 | } |