xref: /llvm-project/clang/test/SemaObjC/class-extension-dup-methods.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3@interface Foo
4- (int)  garf; // expected-note {{previous declaration is here}}
5- (int) OK;
6+ (int)  cgarf; // expected-note {{previous declaration is here}}
7- (int)  InstMeth;
8@end
9
10@interface Foo()
11- (void)  garf; // expected-error {{duplicate declaration of method 'garf'}}
12+ (void)  cgarf; // expected-error {{duplicate declaration of method 'cgarf'}}
13+ (int)  InstMeth;
14- (int) OK;
15@end
16
17@class NSObject;
18
19__attribute__((objc_root_class)) @interface AppDelegate
20+ (void)someMethodWithArgument:(NSObject *)argument;
21+ (void)someMethodWithArgument:(NSObject *)argument : (NSObject*) argument2; // expected-note {{previous declaration is here}}
22@end
23
24@interface AppDelegate ()
25- (void)someMethodWithArgument:(float)argument; // OK. No warning to be issued here.
26+ (void)someMethodWithArgument:(float)argument : (float)argument2; // expected-error {{duplicate declaration of method 'someMethodWithArgument::'}}
27@end
28
29__attribute__((objc_root_class))
30@interface Test
31-(void)meth; // expected-note {{declared here}}
32@end
33
34@interface Test()
35-(void)meth;
36@end
37
38@implementation Test // expected-warning {{method definition for 'meth' not found}}
39@end
40