Debian Codegraph @

gcc/testsuite/obj-c++.dg/method-9.mm

raw
1 /* Test for lookup of class (factory) methods. */
2 /* Author: Ziemowit Laski <[email protected]>. */
3 /* { dg-do compile } */
4 // { dg-additional-options "-Wno-objc-root-class" }
5
6 @interface MyBase
7 - (void) rootInstanceMethod;
8 @end
9
10 @interface MyIntermediate: MyBase
11 @end
12
13 @interface MyDerived: MyIntermediate
14 - (void) instanceMethod;
15 + (void) classMethod;
16 @end
17
18 @implementation MyDerived
19 - (void) instanceMethod {
20 }
21
22 + (void) classMethod { /* If a class method is not found, the root */
23 [self rootInstanceMethod]; /* class is searched for an instance method */
24 [MyIntermediate rootInstanceMethod]; /* with the same name. */
25
26 [self instanceMethod]; /* { dg-warning ".MyDerived. may not respond to .\\+instanceMethod." } */
27 [MyDerived instanceMethod]; /* { dg-warning ".MyDerived. may not respond to .\\+instanceMethod." } */
28 }
29 @end
30
31 /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */