]>
Commit | Line | Data |
---|---|---|
a693d3a8 NP |
1 | /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ |
2 | /* { dg-do compile } */ | |
3 | ||
4 | /* Test that protocol qualifiers are maintained correctly when a | |
5 | @class is replaced by its @interface. */ | |
6 | ||
7 | #include <objc/objc.h> | |
8 | ||
9 | @protocol MyProtocol | |
10 | - (void) method; | |
11 | @end | |
12 | ||
13 | @class MyClass; | |
14 | ||
15 | static MyClass <MyProtocol> *object1; | |
16 | static MyClass *object2; | |
17 | ||
18 | /* Declarating the @interface now will need to update all the existing | |
19 | ObjC types referring to MyClass with the new information. We need | |
20 | to test that protocol information is not lost in the process. */ | |
21 | @interface MyClass | |
22 | @end | |
23 | ||
24 | void test1 (void) | |
25 | { | |
26 | [object1 method]; /* Ok */ | |
27 | [object2 method]; /* { dg-warning ".MyClass. may not respond to ..method." } */ | |
a9c697b8 MS |
28 | |
29 | /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept '\.\.\.' as arguments" "" { target *-*-* } 0 } */ | |
a693d3a8 | 30 | } |