diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 06f3642c271a..9e0d250536ff 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1532,7 +1532,8 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( Param->setInvalidDecl(); } Param->setDeclContext(ObjCMethod); - IdResolver.RemoveDecl(Param); + if (Param->getDeclName()) + IdResolver.RemoveDecl(Param); Params.push_back(Param); } diff --git a/clang/test/SemaObjC/protocols.m b/clang/test/SemaObjC/protocols.m index 8447fe2aad2f..ca38f20fbd01 100644 --- a/clang/test/SemaObjC/protocols.m +++ b/clang/test/SemaObjC/protocols.m @@ -61,3 +61,7 @@ @protocol B < A > // expected-error{{protocol has circular dependency}} @end +@protocol P +- (int)test:(int)param, ..; // expected-warning{{type specifier missing}} \ + // expected-error{{expected ';' after method prototype}} +@end