minix/external/bsd/llvm/dist/clang/test/SemaObjC/class-method-lookup.m
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

46 lines
1.1 KiB
Objective-C

// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyBase
- (void) rootInstanceMethod;
@end
@interface MyIntermediate: MyBase
@end
@interface MyDerived: MyIntermediate
- (void) instanceMethod;
+ (void) classMethod;
@end
@implementation MyDerived
- (void) instanceMethod {
}
+ (void) classMethod { /* If a class method is not found, the root */
[self rootInstanceMethod]; /* class is searched for an instance method */
[MyIntermediate rootInstanceMethod]; /* with the same name. */
[self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
[MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
}
@end
@interface Object @end
@interface Class1
- (void)setWindow:(Object *)wdw;
@end
@interface Class2
- (void)setWindow:(Class1 *)window;
@end
#define nil (void*)0
id foo(void) {
Object *obj;
id obj2 = obj;
[obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}}
return obj;
}