view gcc/testsuite/objc.dg/fobjc-exceptions-1.m @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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;       /* Nothing, error has already been produced.  */
  }
  @catch (id object)
    {
      number++;
      @throw;       /* Nothing, error has already been produced.  */
    }
  @finally
    {
      number++;
    }
  
  @synchronized (o) /* Nothing, error has already been produced.  */
    {
      number++;
    }
  
  return number;
}