aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc/execute/exceptions/foward-1.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/objc/execute/exceptions/foward-1.m')
-rw-r--r--gcc-4.9/gcc/testsuite/objc/execute/exceptions/foward-1.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/objc/execute/exceptions/foward-1.m b/gcc-4.9/gcc/testsuite/objc/execute/exceptions/foward-1.m
new file mode 100644
index 000000000..5738b225e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/objc/execute/exceptions/foward-1.m
@@ -0,0 +1,42 @@
+/* Check that throwing an exception from a -forward:: works. */
+/* Developed by Marcin Koziej <creep@desk.pl>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
+
+static int i;
+
+__attribute__((objc_exception))
+@interface Thrower : TestsuiteObject
+- forward: (SEL) s : (void*) a;
+@end
+
+@implementation Thrower
+- forward: (SEL) s : (void*) a
+{
+ i++;
+ @throw [TestsuiteObject new];
+ return nil;
+}
+@end
+
+int
+main()
+{
+ id t = [Thrower new];
+ @try
+ {
+ [t doesnotexist];
+ }
+ @catch (id error)
+ {
+ i++;
+ [error free];
+ }
+
+ if (i != 2)
+ abort ();
+
+ return 0;
+}