• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
2
3@interface A @end
4@interface B : A @end
5
6@interface Test1 {}
7- (void) test1:(A*) object; // expected-note {{previous definition is here}}
8- (void) test2:(B*) object;
9@end
10
11@implementation Test1
12- (void) test1:(B*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'A *' vs 'B *'}}
13- (void) test2:(A*) object {}
14@end
15
16@interface Test2 {}
17- (void) test1:(id) object; // expected-note {{previous definition is here}}
18- (void) test2:(A*) object;
19@end
20
21@implementation Test2
22- (void) test1:(A*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'id' vs 'A *'}}
23- (void) test2:(id) object {}
24@end
25
26@interface Test3 {}
27- (A*) test1;
28- (B*) test2; // expected-note {{previous definition is here}}
29@end
30
31@implementation Test3
32- (B*) test1 { return 0; }
33- (A*) test2 { return 0; } // expected-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
34@end
35
36// The particular case of overriding with an id return is white-listed.
37@interface Test4 {}
38- (id) test1;
39- (A*) test2;
40@end
41@implementation Test4
42- (A*) test1 { return 0; } // id -> A* is rdar://problem/8596987
43- (id) test2 { return 0; }
44@end
45