blob: eb75eade0a1d31c3c6280a88d3ad5006e835c8c4 [file] [log] [blame]
Fariborz Jahaniandbdec8b2009-08-04 01:07:16 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3@interface Root
4-(void) method_r: (char)ch : (float*)f1 : (int*) x; // expected-note {{previous declaration is here}}
5@end
6
7@class Sub;
8
9@interface Base : Root
10-(void) method: (int*) x; // expected-note {{previous declaration is here}}
11-(void) method1: (Base*) x; // expected-note {{previous declaration is here}}
12-(void) method2: (Sub*) x;
13+ method3: (int)x1 : (Base *)x2 : (float)x3; // expected-note {{previous declaration is here}}
14+ mathod4: (id)x1;
15@end
16
17struct A {
18 int x,y,z;
19};
20
21@interface Sub : Base
22-(void) method: (struct A*) a; // expected-warning {{method parameter type 'struct A *' does not match super class method parameter type 'int *'}}
23-(void) method1: (Sub*) x; // expected-warning {{method parameter type 'Sub *' does not match super class method parameter type 'Base *'}}
24-(void) method2: (Base*) x; // no need to warn. At call point we warn if need be.
25+ method3: (int)x1 : (Sub *)x2 : (float)x3; // expected-warning {{method parameter type 'Sub *' does not match super class method parameter type 'Base *'}}
26+ mathod4: (Base*)x1;
27-(void) method_r: (char)ch : (float*)f1 : (Sub*) x; // expected-warning {{method parameter type 'Sub *' does not match super class method parameter type 'int *'}}
28@end
29
30void f(Base *base, Sub *sub) {
31 int x;
32 [base method:&x]; // warn. if base is actually 'Sub' it will use -[Sub method] with wrong arguments
33
34 Base *b;
35 [base method1:b]; // if base is actuall 'Sub' it will use [Sub method1] with wrong argument.
36
37 [base method2:b]; // expected-warning {{}}
38
39 Sub *s;
40 [base method2:s]; // if base is actually 'Sub' OK. Either way OK.
41
42}
43
44
45
46