1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2 /* { dg-options "-fobjc-exceptions" } */
3 /* { dg-do compile } */
5 /* Test that you can use an unnamed argument with @catch. This test is the same
6 as exceptions-3.mm, but with no name for @catch arguments. */
13 } /* { dg-line interface_MyObject } */
16 @implementation MyObject
21 typedef MyObject MyObjectTypedef;
22 typedef MyObject *MyObjectPtrTypedef;
23 typedef int intTypedef;
29 @try { @throw object; }
30 @catch (int) /* { dg-error "@catch parameter is not a known Objective-C class type" } */
35 @try { @throw object; }
36 @catch (intTypedef) /* { dg-error "@catch parameter is not a known Objective-C class type" } */
41 @try { @throw object; }
42 @catch (int *) /* { dg-error "@catch parameter is not a known Objective-C class type" } */
47 @try { @throw object; }
53 @try { @throw object; }
54 @catch (id <MyProtocol>) /* { dg-error "@catch parameter can not be protocol-qualified" } */
59 @try { @throw object; }
60 @catch (MyObject *) /* Ok */
65 @try { @throw object; }
66 @catch (MyObject <MyProtocol> *) /* { dg-error "@catch parameter can not be protocol-qualified" } */
71 @try { @throw object; }
72 @catch (MyObject) /* { dg-error "@catch parameter is not a known Objective-C class type" } */
73 { /* { dg-error "no matching function" "" { target *-*-* } .-1 } */
74 dummy++; /* { dg-message "MyObject" "" { target *-*-* } interface_MyObject } */
75 } /* { dg-message "candidate" "" { target *-*-* } interface_MyObject } */
77 @try { @throw object; }
78 @catch (static MyObject *) /* { dg-error "storage class" } */
83 @try { @throw object; }
84 @catch (MyObjectTypedef *) /* Ok */
89 @try { @throw object; }
90 @catch (MyObjectTypedef <MyProtocol> *) /* { dg-error "@catch parameter can not be protocol-qualified" } */
95 @try { @throw object; }
96 @catch (MyObjectPtrTypedef) /* Ok */
101 @try { @throw object; }
102 @catch (Class) /* { dg-error "@catch parameter is not a known Objective-C class type" } */
107 @try { @throw object; }
108 @catch (...) /* Ok */