From d8fb1e30ebc39aeeca0a99ac20e02e08444b56f6 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 1 Dec 2011 01:37:36 +0000 Subject: When sending a message to a receiver that has "unknown any" type, force the unknown any type to "id" so that the message send can be completed without requiring a case. Fixes . llvm-svn: 145552 --- clang/lib/Sema/SemaExpr.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/lib/Sema/SemaExpr.cpp') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 12a13f1aa45..1e9f319d4f7 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3691,6 +3691,11 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, } // If we're directly calling a function, get the appropriate declaration. + if (Fn->getType() == Context.UnknownAnyTy) { + ExprResult result = rebuildUnknownAnyFunction(*this, Fn); + if (result.isInvalid()) return ExprError(); + Fn = result.take(); + } Expr *NakedFn = Fn->IgnoreParens(); @@ -10110,6 +10115,10 @@ ExprResult Sema::checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, return CastExpr; } +ExprResult Sema::forceUnknownAnyToType(Expr *E, QualType ToType) { + return RebuildUnknownAnyExpr(*this, ToType).Visit(E); +} + static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *E) { Expr *orig = E; unsigned diagID = diag::err_uncasted_use_of_unknown_any; -- cgit v1.2.3