From 0700bbfbccc639f093f0e2a9b2ae94a213f218b4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 26 Oct 2010 05:45:40 +0000 Subject: [PATCH] Delay complete-type checking for arguments to no-prototype functions until after we've checked/promoted the argument. Hopefully fixes the Emacs regression due to my recent change that expanded type-checking in the presence of K&R function definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117353 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExpr.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 0510bd2ed8..f8c7a90f8f 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3858,12 +3858,6 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, Expr *Arg = Args[i]; if (Proto && i < Proto->getNumArgs()) { - if (RequireCompleteType(Arg->getSourceRange().getBegin(), - Arg->getType(), - PDiag(diag::err_call_incomplete_argument) - << Arg->getSourceRange())) - return ExprError(); - InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, Proto->getArgType(i)); @@ -3877,14 +3871,14 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } else { DefaultArgumentPromotion(Arg); - - if (RequireCompleteType(Arg->getSourceRange().getBegin(), - Arg->getType(), - PDiag(diag::err_call_incomplete_argument) - << Arg->getSourceRange())) - return ExprError(); } + if (RequireCompleteType(Arg->getSourceRange().getBegin(), + Arg->getType(), + PDiag(diag::err_call_incomplete_argument) + << Arg->getSourceRange())) + return ExprError(); + TheCall->setArg(i, Arg); } } -- 2.40.0