2007-03-01 Paul Brook <paul@codesourcery.com>
[official-gcc.git] / gcc / testsuite / objc.dg / proto-hier-2.m
blob819cf4a5089b15b117580fa6e918dfa8a444f99b
1 /* Test protocol warning.  */
2 /* Contributed by Devang Patel <dpatel@apple.com>.  */
3 /* { dg-do compile } */
5 typedef struct objc_object { struct objc_class *class_pointer; } *id;
7 @protocol Bar
8 @end
10 id <Bar> Foo_Bar () { }
12 typedef struct
14         int i;
15 } MyStruct;
17 @interface Foo
19   id _mainData;
20   MyStruct *_anotherData;
23 -(id) mainDataSource;
24 -(id) anotherDataSource;
25 -(id) my_method: (int) i;
26 @end
28 @implementation Foo
29 -(id) anotherDataSource
31         return (id)_anotherData;
34 -(id) mainDataSource
36         return _mainData;
39 -(id) my_method: (int) i
41   id one = [self anotherDataSource];
43   i = i - 1;
44   // Do not issue warning about my_method not found in protocol
45   return [(one ? [self mainDataSource] : one) my_method:i];
48 @end