Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -Woverriding-method-mismatch -fsyntax-only -verify -Wno-objc-root-class %s |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 2 | // rdar://9352731 |
| 3 | |
| 4 | @protocol Bar |
| 5 | @required |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 6 | - (bycopy id)bud; // expected-note {{previous declaration is here}} |
| 7 | - (unsigned char) baz; // expected-note {{previous declaration is here}} |
| 8 | - (char) ok; |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 9 | - (void) also_ok; |
| 10 | @end |
| 11 | |
| 12 | @protocol Bar1 |
| 13 | @required |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 14 | - (unsigned char) baz; // expected-note {{previous declaration is here}} |
| 15 | - (unsigned char) also_ok; // expected-note {{previous declaration is here}} |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 16 | - (void) ban : (int) arg, ...; // expected-note {{previous declaration is here}} |
| 17 | @end |
| 18 | |
| 19 | @protocol Baz <Bar, Bar1> |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 20 | - (void) bar : (unsigned char)arg; // expected-note {{previous declaration is here}} |
| 21 | - (void) ok; |
| 22 | - (char) bak; // expected-note {{previous declaration is here}} |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 23 | @end |
| 24 | |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 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'}} |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 28 | - (void) bar : (unsigned char*)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'unsigned char' vs 'unsigned char *'}} |
| 29 | - (void) ok; |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 30 | - (void) also_ok; // expected-warning {{conflicting return type in declaration of 'also_ok': 'unsigned char' vs 'void'}} |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 31 | - (void) still_ok; |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 32 | - (void) ban : (int) arg; // expected-warning {{conflicting variadic declaration of method and its implementation}} |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 33 | @end |
| 34 | |
| 35 | @interface Foo() |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 36 | - (void) bak; |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 37 | @end |
| 38 | |
| 39 | @implementation Foo |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 40 | - (bycopy id)bud { return 0; } |
Fariborz Jahanian | eee3ef1 | 2011-07-24 20:53:26 +0000 | [diff] [blame] | 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 {} |
Fariborz Jahanian | 730cfb1 | 2011-08-10 17:16:30 +0000 | [diff] [blame] | 47 | - (void) bak {} // expected-warning {{conflicting return type in declaration of 'bak': 'char' vs 'void'}} |
Fariborz Jahanian | 7413307 | 2011-08-03 18:21:12 +0000 | [diff] [blame] | 48 | @end |