FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / objc.dg / method-2.m
blobb4cd4da637693111ae6079ae8083f613f9cf4a27
1 /* Test for lookup of class (factory) methods.  */
2 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
3 /* { dg-do compile } */
5 @interface MyBase 
6 - (void) rootInstanceMethod;
7 @end
9 @interface MyIntermediate: MyBase
10 @end
12 @interface MyDerived: MyIntermediate
13 - (void) instanceMethod;
14 + (void) classMethod;
15 @end
17 @implementation MyDerived
18 - (void) instanceMethod {
21 + (void) classMethod {                    /* If a class method is not found, the root  */
22     [self rootInstanceMethod];            /* class is searched for an instance method  */
23     [MyIntermediate rootInstanceMethod];  /* with the same name.                       */
25     [self instanceMethod];       /* { dg-warning "cannot find class" } */
26     /* { dg-warning "defaults to id" "" { target *-*-* } 25 } */
27     [MyDerived instanceMethod];  /* { dg-warning "cannot find class" } */
28     /* { dg-warning "defaults to id" "" { target *-*-* } 27 } */ 
30 @end