OSDN Git Service

* objc.dg/fobjc-exceptions.m: New test.
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Sep 2010 09:54:54 +0000 (09:54 +0000)
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Sep 2010 09:54:54 +0000 (09:54 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164152 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/objc.dg/fobjc-exceptions.m [new file with mode: 0644]

index f9292f1..7f4f87b 100644 (file)
@@ -1,3 +1,7 @@
+2010-09-10  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * objc.dg/fobjc-exceptions.m: New test.
+
 2010-09-10  Jan Hubicka  <jh@suse.cz>
 
        * g++.dg/inherit/covariant7.C: Fix pattern matching.
diff --git a/gcc/testsuite/objc.dg/fobjc-exceptions.m b/gcc/testsuite/objc.dg/fobjc-exceptions.m
new file mode 100644 (file)
index 0000000..afdc15f
--- /dev/null
@@ -0,0 +1,29 @@
+/* Test that Objective-C exceptions cause an error with -fobjc-exceptions.  */
+/* { dg-do compile } */
+
+@class Object;
+
+int dummy (int number, Object *o)
+{
+  @try {            /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+    number++;
+    @throw o;     /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+  }
+  @catch (id object)
+    {
+      number++;
+      @throw;       /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+    }
+  @finally
+    {
+      number++;
+    }
+  
+  @synchronized (o) /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+    {
+      number++;
+    }
+  
+  return number;
+}
+