1 | // RUN: %clang_cc1 -Woverriding-method-mismatch -fsyntax-only -verify -Wno-objc-root-class %s |
2 | // rdar://9352731 |
3 | |
4 | @protocol Bar |
5 | @required |
6 | - (bycopy id)bud; // expected-note {{previous declaration is here}} |
7 | - (unsigned char) baz; // expected-note {{previous declaration is here}} |
8 | - (char) ok; |
9 | - (void) also_ok; |
10 | @end |
11 | |
12 | @protocol Bar1 |
13 | @required |
14 | - (unsigned char) baz; // expected-note {{previous declaration is here}} |
15 | - (unsigned char) also_ok; // expected-note {{previous declaration is here}} |
16 | - (void) ban : (int) arg, ...; // expected-note {{previous declaration is here}} |
17 | @end |
18 | |
19 | @protocol Baz <Bar, Bar1> |
20 | - (void) bar : (unsigned char)arg; // expected-note {{previous declaration is here}} |
21 | - (void) ok; |
22 | - (char) bak; // expected-note {{previous declaration is here}} |
23 | @end |
24 | |
25 | @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'}} |
28 | - (void) bar : (unsigned char*)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'unsigned char' vs 'unsigned char *'}} |
29 | - (void) ok; |
30 | - (void) also_ok; // expected-warning {{conflicting return type in declaration of 'also_ok': 'unsigned char' vs 'void'}} |
31 | - (void) still_ok; |
32 | - (void) ban : (int) arg; // expected-warning {{conflicting variadic declaration of method and its implementation}} |
33 | @end |
34 | |
35 | @interface Foo() |
36 | - (void) bak; |
37 | @end |
38 | |
39 | @implementation Foo |
40 | - (bycopy id)bud { return 0; } |
41 | - (void) baz {} |
42 | - (void) bar : (unsigned char*)arg {} |
43 | - (void) ok {} |
44 | - (void) also_ok {} |
45 | - (void) still_ok {} |
46 | - (void) ban : (int) arg {} |
47 | - (void) bak {} // expected-warning {{conflicting return type in declaration of 'bak': 'char' vs 'void'}} |
48 | @end |
49 | |