diff options
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 3 | ||||
-rw-r--r-- | test/SemaObjC/super.m | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 9ec5f1677f..e479c36792 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -1444,7 +1444,8 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, // Reject the cast of super idiom in ObjC. if (Tok.is(tok::identifier) && getLang().ObjC1 && Tok.getIdentifierInfo() == Ident_super && - CurScope->isInObjcMethodScope()) { + CurScope->isInObjcMethodScope() && + GetLookAheadToken(1).isNot(tok::period)) { Diag(Tok.getLocation(), diag::err_illegal_super_cast) << SourceRange(OpenLoc, RParenLoc); return ExprError(); diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m index d751d17719..9498a8ce7e 100644 --- a/test/SemaObjC/super.m +++ b/test/SemaObjC/super.m @@ -34,7 +34,11 @@ void takevoidptr(void*); [super cMethod]; // expected-warning{{method '+cMethod' not found (return type defaults to 'id')}} id X[] = { [ super superClassMethod] }; - id Y[] = { [ super.superClassMethod iMethod] }; + id Y[] = { + [ super.superClassMethod iMethod], + super.superClassMethod, + (id)super.superClassMethod // not a cast of super: rdar://7853261 + }; return 0; } @end |