aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExprObjC.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index ed6e917f55..520ea2af91 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -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);
}