OSDN Git Service

PR testsuite/24841
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / proto-hier-2.m
1 /* Test protocol warning.  */
2 /* Contributed by Devang Patel <dpatel@apple.com>.  */
3 /* { dg-do compile } */
4
5 typedef struct objc_object { struct objc_class *class_pointer; } *id;
6
7 @protocol Bar
8 @end
9
10 id <Bar> Foo_Bar () { }
11
12 typedef struct
13 {
14         int i;
15 } MyStruct;
16
17 @interface Foo
18 {
19   id _mainData;
20   MyStruct *_anotherData;
21 }
22
23 -(id) mainDataSource;
24 -(id) anotherDataSource;
25 -(id) my_method: (int) i;
26 @end
27
28 @implementation Foo
29 -(id) anotherDataSource
30 {
31         return (id)_anotherData;
32 }
33
34 -(id) mainDataSource
35 {
36         return _mainData;
37 }
38
39 -(id) my_method: (int) i
40 {
41   id one = [self anotherDataSource];
42
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];
46 }
47
48 @end
49