blob: 37df7a641673241a9b0ab6925bb9946d160edebd [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanian759abb42011-04-06 18:40:08 +00002// rdar://9224670
3
4@interface RandomObject {
5@private
6}
7+ (id)alloc;
8@end
9
10@protocol TestProtocol
11- (void)nothingInteresting;
12@end
13
14@protocol Test2Protocol
15+ (id)alloc;
Ted Kremenek3306ec12012-02-27 22:55:11 +000016- (id)alloc2; // expected-note 2 {{method 'alloc2' declared here}}
Fariborz Jahanian759abb42011-04-06 18:40:08 +000017@end
18
19@implementation RandomObject
20- (void) Meth {
21 Class<TestProtocol> c = [c alloc]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}}
22 Class<Test2Protocol> c1 = [c1 alloc2]; // expected-warning {{instance method 'alloc2' found instead of class method 'alloc2'}}
23 Class<Test2Protocol> c2 = [c2 alloc]; // ok
24}
25+ (id)alloc { return 0; }
26@end
27
28int main ()
29{
30 Class<TestProtocol> c = [c alloc]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}}
31 Class<Test2Protocol> c1 = [c1 alloc2]; // expected-warning {{instance method 'alloc2' found instead of class method 'alloc2'}}
32 Class<Test2Protocol> c2 = [c2 alloc]; // ok
33 return 0;
34}