]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/obj-c++.dg/exceptions-6.mm
trans.c (check_inlining_for_nested_subprog): Quote reserved names.
[thirdparty/gcc.git] / gcc / testsuite / obj-c++.dg / exceptions-6.mm
CommitLineData
d0f7899a
NP
1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2/* { dg-options "-fobjc-exceptions" } */
3/* { dg-do compile } */
4
5/* Test warnings when parsing syntax errors in @throw. */
6
7#include <objc/objc.h>
8
9void test (id object)
10{
11 @throw object; /* Ok */
a9c697b8 12 @throw; /* { dg-error ".@throw. .rethrow. used outside of a '@catch' block" } */
d0f7899a 13 @throw (object); /* Ok. */
62e1c678
DM
14 @throw (id)0 /* { dg-error "expected" } */
15}
d0f7899a
NP
16
17void test2 (id object)
18{
19 @throw object); /* { dg-error "expected" } */
20 @throw (...); /* { dg-error "expected" } */
21 @throw (); /* { dg-error "expected" } */
62e1c678 22 @throw /* { dg-error "expected" } */
d0f7899a
NP
23} /* { dg-error "expected" } */
24
25void test3 (id object1, id object2)
26{
27 /* This is apparently valid. */
28 @throw object1, object2; /* Ok. */
29}