gcc/testsuite/objc.dg/invalid-method-2.m
raw| 1 | /* { dg-do compile } */ |
| 2 | |
| 3 | /* Test that using an invalid type in a method declaration produces a |
| 4 | friendly error without a compiler crash. */ |
| 5 | |
| 6 | #if defined(__has_attribute) && __has_attribute(objc_root_class) |
| 7 | __attribute__((objc_root_class)) |
| 8 | #endif |
| 9 | @interface MyClass |
| 10 | @end |
| 11 | |
| 12 | @implementation MyClass |
| 13 | - (x) method /* { dg-error "unknown type name" } */ |
| 14 | { |
| 15 | return 0; |
| 16 | } |
| 17 | - (id) method2: (x)argument /* { dg-error "unknown type name" } */ |
| 18 | { |
| 19 | return 0; |
| 20 | } |
| 21 | @end |