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