diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 85889fa5d6..ea8f4e3e89 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -398,7 +398,17 @@ Sema::ExprResult Sema::ActOnClassMessage( return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, selectorLoc, rbrac, Args, NumArgs); } - return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName; + else if (TypedefDecl *OCTD = dyn_cast_or_null(SuperDecl)) { + const ObjCInterfaceType *OCIT; + OCIT = OCTD->getUnderlyingType()->getAs(); + if (!OCIT) { + Diag(receiverLoc, diag::err_invalid_receiver_to_message); + return true; + } + ClassDecl = OCIT->getDecl(); + } + else + return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName; } } else ClassDecl = getObjCInterfaceDecl(receiverName, receiverLoc); diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m index 3b8697288a..a61d72fda5 100644 --- a/test/SemaObjC/super.m +++ b/test/SemaObjC/super.m @@ -39,3 +39,10 @@ void f0(int super) { void f1(int puper) { [super m]; // expected-error{{use of undeclared identifier 'super'}} } + +// radar 7400691 +typedef Foo super; + +void test() { + [super cMethod]; +}