summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2005-07-26 14:27:33 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2005-07-26 07:27:33 -0700
commit84fd360ddcdabfe1209c0139aa937e9e0ee7547a (patch)
tree66e7ece37d4f807569dcb1cffb5e42711da37e1d /gcc/testsuite/objc.dg
parenta4174ebf41fcfc398b6868b1c71f3172993f76da (diff)
downloadgcc-84fd360ddcdabfe1209c0139aa937e9e0ee7547a.tar.gz
re PR libobjc/22606 (Exceptions cannot be thrown from -forward::)
2005-07-26 Andrew Pinski <pinskia@physics.uc.edu> PR libobjc/22606 * Makefile.in (ALL_CFLAGS): Add -fexceptions. 2005-07-26 Andrew Pinski <pinskia@physics.uc.edu> PR libobjc/22606 * objc.dg/try-catch-11.m: New test. From-SVN: r102386
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r--gcc/testsuite/objc.dg/try-catch-11.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/try-catch-11.m b/gcc/testsuite/objc.dg/try-catch-11.m
new file mode 100644
index 00000000000..745deca7c1d
--- /dev/null
+++ b/gcc/testsuite/objc.dg/try-catch-11.m
@@ -0,0 +1,42 @@
+/* Check that throwing an exception from a -forward:: works. */
+/* Developed by Marcin Koziej <creep@desk.pl>. */
+
+/* { dg-do run } */
+/* { dg-options "-fobjc-exceptions -w" } */
+
+#import <objc/Object.h>
+#import <objc/objc-api.h>
+#include <stdlib.h>
+
+static int i;
+
+@interface Thrower : Object
+- forward: (SEL) s : (void*) a;
+@end
+
+@implementation Thrower
+- forward: (SEL) s : (void*) a
+{
+ i++;
+ @throw [Object new];
+}
+@end
+int
+main()
+{
+ id t = [Thrower new];
+ @try
+ {
+ [t doesnotexist];
+ }
+ @catch (id error)
+ {
+ i++;
+ [error free];
+ }
+
+ if (i != 2)
+ abort ();
+
+ return 0;
+} \ No newline at end of file