111
|
1 /* Test that Objective-C exceptions cause an error with -fobjc-exceptions. */
|
|
2 /* { dg-do compile } */
|
|
3
|
|
4 @class Object;
|
|
5
|
|
6 int dummy (int number, Object *o)
|
|
7 {
|
|
8 @throw o; /* { dg-error ".-fobjc-exceptions. is required to enable Objective-C exception syntax" } */
|
|
9
|
|
10 @try { /* Nothing, error has already been produced. */
|
|
11 number++;
|
|
12 @throw o; /* Nothing, error has already been produced. */
|
|
13 }
|
|
14 @catch (id object)
|
|
15 {
|
|
16 number++;
|
|
17 @throw; /* Nothing, error has already been produced. */
|
|
18 }
|
|
19 @finally
|
|
20 {
|
|
21 number++;
|
|
22 }
|
|
23
|
|
24 @synchronized (o) /* Nothing, error has already been produced. */
|
|
25 {
|
|
26 number++;
|
|
27 }
|
|
28
|
|
29 return number;
|
|
30 }
|