1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | |
3 | @interface MyBase |
4 | - (void) rootInstanceMethod; |
5 | @end |
6 | |
7 | @interface MyIntermediate: MyBase |
8 | @end |
9 | |
10 | @interface MyDerived: MyIntermediate |
11 | - (void) instanceMethod; |
12 | + (void) classMethod; |
13 | @end |
14 | |
15 | @implementation MyDerived |
16 | - (void) instanceMethod { |
17 | } |
18 | |
19 | + (void) classMethod { /* If a class method is not found, the root */ |
20 | [self rootInstanceMethod]; /* class is searched for an instance method */ |
21 | [MyIntermediate rootInstanceMethod]; /* with the same name. */ |
22 | |
23 | [self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}} |
24 | [MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}} |
25 | } |
26 | @end |
27 | |
28 | @interface Object @end |
29 | |
30 | @interface Class1 |
31 | - (void)setWindow:(Object *)wdw; |
32 | @end |
33 | |
34 | @interface Class2 |
35 | - (void)setWindow:(Class1 *)window; |
36 | @end |
37 | |
38 | #define nil (void*)0 |
39 | |
40 | id foo(void) { |
41 | Object *obj; |
42 | id obj2 = obj; |
43 | [obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}} |
44 | |
45 | return obj; |
46 | } |
47 | |