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