forked from OSchip/llvm-project
C return types must be complete as well.
Moved check before we build the ObjCMessageExpr node. (PR7386 related). llvm-svn: 106139
This commit is contained in:
parent
79b0da30fb
commit
18e0275033
|
@ -1007,6 +1007,12 @@ Sema::OwningExprResult Sema::BuildInstanceMessage(ExprArg ReceiverE,
|
|||
if (CheckMessageArgumentTypes(Args, NumArgs, Sel, Method, false,
|
||||
LBracLoc, RBracLoc, ReturnType))
|
||||
return ExprError();
|
||||
|
||||
if (!ReturnType->isVoidType()) {
|
||||
if (RequireCompleteType(LBracLoc, ReturnType,
|
||||
diag::err_illegal_message_expr_incomplete_type))
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
// Construct the appropriate ObjCMessageExpr instance.
|
||||
Expr *Result;
|
||||
|
@ -1018,11 +1024,6 @@ Sema::OwningExprResult Sema::BuildInstanceMessage(ExprArg ReceiverE,
|
|||
else
|
||||
Result = ObjCMessageExpr::Create(Context, ReturnType, LBracLoc, Receiver,
|
||||
Sel, Method, Args, NumArgs, RBracLoc);
|
||||
if (Context.getLangOptions().CPlusPlus && !ReturnType->isVoidType()) {
|
||||
if (RequireCompleteType(LBracLoc, ReturnType,
|
||||
diag::err_illegal_message_expr_incomplete_type))
|
||||
return ExprError();
|
||||
}
|
||||
return MaybeBindToTemporary(Result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue