llvm-project/clang/test/SemaObjC/class-protocol-method-match.m

65 lines
2.0 KiB
Mathematica
Raw Normal View History

// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://9352731
@protocol Bar
@required
- (unsigned char) baz; // expected-note {{previous definition is here}}
- (char) ok; // expected-note {{previous definition is here}}
- (void) also_ok;
@end
@protocol Bar1
@required
- (unsigned char) baz;
- (unsigned char) also_ok;
- (void) ban : (int) arg, ...; // expected-note {{previous declaration is here}}
@end
@protocol Baz <Bar, Bar1>
- (void) bar : (unsigned char)arg; // expected-note {{previous definition is here}}
- (void) ok; // expected-warning {{conflicting return type in declaration of 'ok': 'char' vs 'void'}}
- (char) bak; // expected-note {{previous definition is here}}
@end
@interface Foo <Baz> // expected-note {{class is declared here}}
- (void) baz; // expected-warning {{conflicting return type in declaration of 'baz': 'unsigned char' vs 'void'}}
- (void) bar : (unsigned char*)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'unsigned char' vs 'unsigned char *'}}
- (void) ok;
- (void) also_ok;
- (void) still_ok;
- (void) ban : (int) arg; // expected-warning {{conflicting variadic declaration of method and its declaration}}
@end
@interface Foo()
- (void) bak; // expected-warning {{conflicting return type in declaration of 'bak': 'char' vs 'void'}}
@end
@implementation Foo
- (void) baz {}
- (void) bar : (unsigned char*)arg {}
- (void) ok {}
- (void) also_ok {}
- (void) still_ok {}
- (void) ban : (int) arg {}
- (void) bak {}
@end
// rdar://6911214
@protocol Xint
-(void) setX: (int) arg0; // expected-note {{previous definition is here}}
+(void) setX: (int) arg0; // expected-note {{previous definition is here}}
@end
@interface A <Xint>
@end
@interface C : A
-(void) setX: (C*) arg0; // expected-warning {{conflicting parameter types in declaration of 'setX:': 'int' vs 'C *'}}
+(void) setX: (C*) arg0; // expected-warning {{conflicting parameter types in declaration of 'setX:': 'int' vs 'C *'}}
@end
@implementation C
-(void) setX: (C*) arg0 {}
+(void) setX: (C*) arg0 {}
@end