aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/fobjc-exceptions.m
blob: afdc15f716db90e199d05a72771c652ad9bba2c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
}