blob: 8c8c21682f1e08b5389052f8a085466e216174f3 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanianb1006c72009-03-04 17:50:39 +00002
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
Fariborz Jahanian26005032010-12-01 01:07:24 +000023 [self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
Fariborz Jahanianb1006c72009-03-04 17:50:39 +000024 [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
40id foo(void) {
41 Object *obj;
42 id obj2 = obj;
Chris Lattner0784fcd2010-04-11 07:04:01 +000043 [obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}}
Fariborz Jahanianb1006c72009-03-04 17:50:39 +000044
45 return obj;
46}