- 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.
This commit is contained in:
Christoph Oelckers 2018-11-16 12:28:24 +01:00
parent 358001c306
commit 8c57447108

View file

@ -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());