From 8c574471088ee9615a905b7b563c890e83760acd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 16 Nov 2018 12:28:24 +0100 Subject: [PATCH] - Restricted argument count check to the void return case. There were some issues here: * a check for mismatching count is too strict because it is legal to omit return values * it failed to detect returning multiple values in a single expression. --- src/scripting/backend/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 6d06f22f9..039a21dab 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -10640,7 +10640,7 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx) PPrototype *retproto; - if (ctx.ReturnProto != nullptr && ctx.ReturnProto->ReturnTypes.Size() != Args.Size()) + if (ctx.ReturnProto != nullptr && ctx.ReturnProto->ReturnTypes.Size() == 0 && ctx.ReturnProto->ReturnTypes.Size() != Args.Size()) { int severity = ctx.Version >= MakeVersion(3, 7) ? MSG_ERROR : MSG_WARNING; ScriptPosition.Message(severity, "Incorrect number of return values. Got %u, but expected %u", Args.Size(), ctx.ReturnProto->ReturnTypes.Size());