Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / exceptions-6.m
blob58882fed8b71acf4000ff4137112d82547ea5074
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-options "-fobjc-exceptions" } */
3 /* { dg-do compile } */
5 /* Test warnings when parsing syntax errors in @throw.  */
7 #include <objc/objc.h>
9 void test (id object)
11   @throw object;   /* Ok */
12   @throw;          /* { dg-error ".@throw. .rethrow. used outside of a @catch block" } */
13   @throw (object); /* Ok.  */
14   @throw (id)0
15 }                  /* { dg-error "expected" } */
17 void test2 (id object)
19   @throw object);  /* { dg-error "expected" } */
20   @throw (...);    /* { dg-error "expected" } */
21   @throw ();       /* { dg-error "expected" } */
22   @throw           
23 }                  /* { dg-error "expected" } */
25 void test3 (id object1, id object2)
27   /* This is apparently valid.  */
28   @throw object1, object2; /* Ok.  */