1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2*f4a2713aSLionel Sambuc// rdar://9224670 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc@interface RandomObject { 5*f4a2713aSLionel Sambuc@private 6*f4a2713aSLionel Sambuc} 7*f4a2713aSLionel Sambuc+ (id)alloc; 8*f4a2713aSLionel Sambuc@end 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc@protocol TestProtocol 11*f4a2713aSLionel Sambuc- (void)nothingInteresting; 12*f4a2713aSLionel Sambuc@end 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc@protocol Test2Protocol 15*f4a2713aSLionel Sambuc+ (id)alloc; 16*f4a2713aSLionel Sambuc- (id)alloc2; // expected-note 2 {{method 'alloc2' declared here}} 17*f4a2713aSLionel Sambuc@end 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc@implementation RandomObject 20*f4a2713aSLionel Sambuc- (void) Meth { 21*f4a2713aSLionel Sambuc Class<TestProtocol> c = [c alloc]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}} 22*f4a2713aSLionel Sambuc Class<Test2Protocol> c1 = [c1 alloc2]; // expected-warning {{instance method 'alloc2' found instead of class method 'alloc2'}} 23*f4a2713aSLionel Sambuc Class<Test2Protocol> c2 = [c2 alloc]; // ok 24*f4a2713aSLionel Sambuc} 25*f4a2713aSLionel Sambuc+ (id)alloc { return 0; } 26*f4a2713aSLionel Sambuc@end 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambucint main () 29*f4a2713aSLionel Sambuc{ 30*f4a2713aSLionel Sambuc Class<TestProtocol> c = [c alloc]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}} 31*f4a2713aSLionel Sambuc Class<Test2Protocol> c1 = [c1 alloc2]; // expected-warning {{instance method 'alloc2' found instead of class method 'alloc2'}} 32*f4a2713aSLionel Sambuc Class<Test2Protocol> c2 = [c2 alloc]; // ok 33*f4a2713aSLionel Sambuc return 0; 34*f4a2713aSLionel Sambuc} 35