1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ 2/* { dg-options "-fobjc-exceptions" } */ 3/* { dg-do compile } */ 4 5/* This test checks the syntax @catch (...) which catches any 6 exceptions. At the moment, @catch (...) is identical to @catch (id 7 exception). */ 8 9#include <objc/objc.h> 10 11@interface MyObject 12{ 13 Class isa; 14} 15@end 16 17@implementation MyObject 18@end 19 20int test (id object) 21{ 22 int i = 0; 23 24 @try 25 { 26 @throw object; 27 } 28 @catch (MyObject *o) 29 { 30 i += 1; 31 } 32 @catch (...) 33 { 34 i += 2; 35 } 36 @finally 37 { 38 i += 4; 39 } 40 41 return i; 42} 43