OSDN Git Service

In gcc/objc/:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / protocol-qualifier-2.m
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." } */
28                     /* { dg-warning "without a matching method" "" { target *-*-* } 27 } */
29                     /* { dg-warning "will be assumed to return" "" { target *-*-* } 27 } */
30                     /* { dg-warning "as arguments" "" { target *-*-* } 27 } */
31 }