xref: /llvm-project/clang/test/SemaObjC/qualified-protocol-method-conflicts.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1  -Woverriding-method-mismatch -fsyntax-only -verify -Wno-objc-root-class %s
2
3@protocol Xint
4-(void) setX: (int) arg0; // expected-note {{previous declaration is here}}
5+(int) C; // expected-note {{previous declaration is here}}
6@end
7
8@protocol Xfloat
9-(void) setX: (float) arg0; // expected-note 2 {{previous declaration is here}}
10+(float) C;		    // expected-note 2 {{previous declaration is here}}
11@end
12
13@interface A <Xint, Xfloat>
14@end
15
16@implementation A
17-(void) setX: (int) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}}
18+(int) C {return 0; } // expected-warning {{conflicting return type in declaration of 'C': 'float' vs 'int'}}
19@end
20
21@interface B <Xfloat, Xint>
22@end
23
24@implementation B
25-(void) setX: (float) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'int' vs 'float'}}
26+ (float) C {return 0.0; } // expected-warning {{conflicting return type in declaration of 'C': 'int' vs 'float'}}
27@end
28
29@protocol Xint_float<Xint, Xfloat>
30@end
31
32@interface C<Xint_float>
33@end
34
35@implementation C
36-(void) setX: (int) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}}
37+ (int) C {return 0;} // expected-warning {{conflicting return type in declaration of 'C': 'float' vs 'int'}}
38@end
39