summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/ParseObjc.cpp4
-rw-r--r--clang/test/Parser/check-syntax-1.m7
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index cb7fe58807a..013e26b891e 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -771,10 +771,12 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
if (getLang().ObjC2 && Tok.is(tok::kw___attribute))
MethodAttrs = ParseAttributes();
+ if (KeyIdents.size() == 0)
+ return DeclPtrTy();
Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
&KeyIdents[0]);
return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
- mType, IDecl, DSRet, ReturnType, Sel,
+ mType, IDecl, DSRet, ReturnType, Sel,
&ArgInfos[0], CargNames, MethodAttrs,
MethodImplKind, isVariadic);
}
diff --git a/clang/test/Parser/check-syntax-1.m b/clang/test/Parser/check-syntax-1.m
index f4aa430cde1..af1b7a8b714 100644
--- a/clang/test/Parser/check-syntax-1.m
+++ b/clang/test/Parser/check-syntax-1.m
@@ -2,3 +2,10 @@
int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
@end
+
+typedef float CGFloat;
+@interface XNSNumber
++ (XNSNumber *) numberWithCGFloat : (CGFloat) float; // expected-error {{expected identifier}} \
+ // expected-error {{ expected ';' after method prototype}}
+@end
+
OpenPOWER on IntegriCloud