From 2d1641f0cd0837c2d07cd95783ae69354d266795 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 29 Mar 2017 00:00:25 +0200 Subject: [PATCH] - fixed: Reference types passed as a reference parameter were not properly checked for. --- src/scripting/backend/codegen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 86e0a4a550..2a178a2494 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8816,12 +8816,15 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) ArgList[i] = ArgList[i]->Resolve(ctx); // nust be resolved before the address is requested. if (ArgList[i] != nullptr && ArgList[i]->ValueType != TypeNullPtr) { - ArgList[i]->RequestAddress(ctx, &writable); - if (flag & VARF_Ref) ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType); + if (type != ArgList[i]->ValueType) + { + ArgList[i]->RequestAddress(ctx, &writable); + if (flag & VARF_Ref)ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType); + } // For a reference argument the types must match 100%. if (type != ArgList[i]->ValueType) { - ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s", Function->SymbolName.GetChars()); + ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s: %s != %s", Function->SymbolName.GetChars(), type->DescriptiveName(), ArgList[i]->ValueType->DescriptiveName()); x = nullptr; } else