ubuntu-buildroot/output/build/host-gcc-initial-11.4.0/gcc/testsuite/objc.dg/fobjc-exceptions-3.m

31 lines
713 B
Mathematica
Raw Normal View History

2024-04-01 15:19:46 +00:00
/* Test that Objective-C exceptions cause an error with -fobjc-exceptions. */
/* { dg-do compile } */
@class Object;
int dummy (int number, Object *o)
{
@throw o; /* { dg-error ".-fobjc-exceptions. is required to enable Objective-C exception syntax" } */
@try { /* Nothing, error has already been produced. */
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;
}