diff options
Diffstat (limited to 'gcc/testsuite/objc')
-rw-r--r-- | gcc/testsuite/objc/execute/exceptions/finally-1.m | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/objc/execute/exceptions/finally-1.m b/gcc/testsuite/objc/execute/exceptions/finally-1.m new file mode 100644 index 0000000..9d4c396 --- /dev/null +++ b/gcc/testsuite/objc/execute/exceptions/finally-1.m @@ -0,0 +1,45 @@ +#include <objc/Object.h> + +int +thrower_try_body() +{ + printf("Thrower try body\n"); + return (0); +} + +int +finally_body() +{ + printf("Finally body\n"); + return (0); +} + +int +thrower() +{ + @try + { + thrower_try_body(); + @throw [Object new]; + } + @finally + { + finally_body(); + } // <----- program aborts here. + return 0; +} + + +int +main(int ac, char *av[]) +{ + @try + { + thrower(); + } + @catch (id exc) + { + printf("Got exception of class %s\n", [[exc class] name]); + [exc free]; + } +} |