gcc/testsuite/objc.dg/try-catch-3.m
raw| 1 | /* Test if caught exception objects are accessible inside the |
| 2 | @catch block. (Yes, I managed to break this.) */ |
| 3 | /* Author: Ziemowit Laski <[email protected]> */ |
| 4 | |
| 5 | /* { dg-do compile } */ |
| 6 | /* { dg-options "-fobjc-exceptions" } */ |
| 7 | |
| 8 | #include "../objc-obj-c++-shared/TestsuiteObject.h" |
| 9 | |
| 10 | const char *foo(void) |
| 11 | { |
| 12 | @try { |
| 13 | return "foo"; |
| 14 | } |
| 15 | @catch (TestsuiteObject* theException) { |
| 16 | return [theException name]; |
| 17 | } |
| 18 | } |
| 19 |