blob: 7c936e653fbabdf867cc09c4226e5965913aaac0 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -Woverriding-method-mismatch -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +00002// rdar://9352731
3
4@protocol Bar
5@required
Fariborz Jahanian730cfb12011-08-10 17:16:30 +00006- (bycopy id)bud; // expected-note {{previous declaration is here}}
7- (unsigned char) baz; // expected-note {{previous declaration is here}}
8- (char) ok;
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +00009- (void) also_ok;
10@end
11
12@protocol Bar1
13@required
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000014- (unsigned char) baz; // expected-note {{previous declaration is here}}
15- (unsigned char) also_ok; // expected-note {{previous declaration is here}}
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000016- (void) ban : (int) arg, ...; // expected-note {{previous declaration is here}}
17@end
18
19@protocol Baz <Bar, Bar1>
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000020- (void) bar : (unsigned char)arg; // expected-note {{previous declaration is here}}
21- (void) ok;
22- (char) bak; // expected-note {{previous declaration is here}}
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000023@end
24
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000025@interface Foo <Baz>
26- (id)bud; // expected-warning {{conflicting distributed object modifiers on return type in declaration of 'bud'}}
27- (void) baz; // expected-warning 2 {{conflicting return type in declaration of 'baz': 'unsigned char' vs 'void'}}
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000028- (void) bar : (unsigned char*)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'unsigned char' vs 'unsigned char *'}}
29- (void) ok;
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000030- (void) also_ok; // expected-warning {{conflicting return type in declaration of 'also_ok': 'unsigned char' vs 'void'}}
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000031- (void) still_ok;
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000032- (void) ban : (int) arg; // expected-warning {{conflicting variadic declaration of method and its implementation}}
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000033@end
34
35@interface Foo()
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000036- (void) bak;
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000037@end
38
39@implementation Foo
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000040- (bycopy id)bud { return 0; }
Fariborz Jahanianeee3ef12011-07-24 20:53:26 +000041- (void) baz {}
42- (void) bar : (unsigned char*)arg {}
43- (void) ok {}
44- (void) also_ok {}
45- (void) still_ok {}
46- (void) ban : (int) arg {}
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000047- (void) bak {} // expected-warning {{conflicting return type in declaration of 'bak': 'char' vs 'void'}}
Fariborz Jahanian74133072011-08-03 18:21:12 +000048@end