blob: d1d5612ef0edd9c38215c849cbf8b6e01c29d097 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -Woverriding-method-mismatch -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanian21121902011-08-08 18:03:17 +00002// rdar://6191214
3
4@protocol Xint
Fariborz Jahanian730cfb12011-08-10 17:16:30 +00005-(void) setX: (int) arg0; // expected-note {{previous declaration is here}}
6+(int) C; // expected-note {{previous declaration is here}}
Fariborz Jahanian21121902011-08-08 18:03:17 +00007@end
8
9@protocol Xfloat
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000010-(void) setX: (float) arg0; // expected-note 2 {{previous declaration is here}}
11+(float) C; // expected-note 2 {{previous declaration is here}}
Fariborz Jahanian21121902011-08-08 18:03:17 +000012@end
13
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000014@interface A <Xint, Xfloat>
Fariborz Jahanian21121902011-08-08 18:03:17 +000015@end
16
17@implementation A
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000018-(void) setX: (int) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}}
19+(int) C {return 0; } // expected-warning {{conflicting return type in declaration of 'C': 'float' vs 'int'}}
Fariborz Jahanian21121902011-08-08 18:03:17 +000020@end
21
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000022@interface B <Xfloat, Xint>
Fariborz Jahanian21121902011-08-08 18:03:17 +000023@end
24
25@implementation B
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000026-(void) setX: (float) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'int' vs 'float'}}
27+ (float) C {return 0.0; } // expected-warning {{conflicting return type in declaration of 'C': 'int' vs 'float'}}
Fariborz Jahanian21121902011-08-08 18:03:17 +000028@end
29
30@protocol Xint_float<Xint, Xfloat>
31@end
32
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000033@interface C<Xint_float>
Fariborz Jahanian21121902011-08-08 18:03:17 +000034@end
35
36@implementation C
Fariborz Jahanian730cfb12011-08-10 17:16:30 +000037-(void) setX: (int) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}}
38+ (int) C {return 0;} // expected-warning {{conflicting return type in declaration of 'C': 'float' vs 'int'}}
Fariborz Jahanian21121902011-08-08 18:03:17 +000039@end