summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/try-catch-3.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/try-catch-3.m')
-rw-r--r--gcc/testsuite/objc.dg/try-catch-3.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/try-catch-3.m b/gcc/testsuite/objc.dg/try-catch-3.m
new file mode 100644
index 000000000..2094d29ce
--- /dev/null
+++ b/gcc/testsuite/objc.dg/try-catch-3.m
@@ -0,0 +1,19 @@
+/* Test if caught exception objects are accessible inside the
+ @catch block. (Yes, I managed to break this.) */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-do compile } */
+/* { dg-options "-fobjc-exceptions" } */
+
+#include "../objc-obj-c++-shared/Object1.h"
+
+const char *foo(void)
+{
+ @try {
+ return "foo";
+ }
+ @catch (Object* theException) {
+ return [theException name];
+ }
+}
+