class method with the same selctor but different argument
types having one of them in class extension.
// rdar://
16312105
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204065
91177308-0d34-0410-b5e6-
96231b3b80d8
return;
for (const auto *Method : CAT->methods()) {
const ObjCMethodDecl *&PrevMethod = MethodMap[Method->getSelector()];
- if (PrevMethod && !MatchTwoMethodDeclarations(Method, PrevMethod)) {
+ if (PrevMethod &&
+ (PrevMethod->isInstanceMethod() == Method->isInstanceMethod()) &&
+ !MatchTwoMethodDeclarations(Method, PrevMethod)) {
Diag(Method->getLocation(), diag::err_duplicate_method_decl)
<< Method->getDeclName();
Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
+ (int) InstMeth;
- (int) OK;
@end
+
+// rdar://16312105
+@class NSObject;
+
+__attribute__((objc_root_class)) @interface AppDelegate
++ (void)someMethodWithArgument:(NSObject *)argument;
++ (void)someMethodWithArgument:(NSObject *)argument : (NSObject*) argument2; // expected-note {{previous declaration is here}}
+@end
+
+@interface AppDelegate ()
+- (void)someMethodWithArgument:(float)argument; // OK. No warning to be issued here.
++ (void)someMethodWithArgument:(float)argument : (float)argument2; // expected-error {{duplicate declaration of method 'someMethodWithArgument::'}}
+@end