From ab6b2f369ead21a8741381eae911a72291f0f890 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 20 Nov 2016 09:47:46 +0100 Subject: [PATCH] - fixed: For varargs, not only the type but also the flag of the last specified argument need to be stored for later parameters. --- src/scripting/codegeneration/codegen.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index 12acc438b4..56ee12eaf7 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -7218,6 +7218,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) { bool foundvarargs = false; PType * type = nullptr; + int flag = 0; if (argtypes.Last() != nullptr && ArgList.Size() + implicit > argtypes.Size()) { ScriptPosition.Message(MSG_ERROR, "Too many arguments in call to %s", Function->SymbolName.GetChars()); @@ -7231,12 +7232,16 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) if (!foundvarargs) { if (argtypes[i + implicit] == nullptr) foundvarargs = true; - else type = argtypes[i + implicit]; + else + { + type = argtypes[i + implicit]; + flag = argflags[i + implicit]; + } } assert(type != nullptr); FxExpression *x; - if (!(argflags[i + implicit] & VARF_Ref)) + if (!(flag & VARF_Ref)) { x = new FxTypeCast(ArgList[i], type, false); x = x->Resolve(ctx);