diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-12 17:09:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-12 17:09:27 +0000 |
commit | 8b9f187ab79e4077067f57660c75d6ac24066c7e (patch) | |
tree | ccc1cfa2f0991423e44555135cd5777dbe50928c | |
parent | 6275e0cac39b76204644154fd99a449f57c589d4 (diff) |
tighten the check for cast of super to avoid rejecting valid code,
rdar://7853261
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101048 91177308-0d34-0410-b5e6-96231b3b80d8
-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 |