diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 28f27f850..8b3ee306a 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -12564,7 +12564,14 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx) { if (Init->IsStruct()) { - ValueType = NewPointer(ValueType); + bool writable = true; + + if(ctx.Version >= MakeVersion(4, 12, 0)) + { + Init->RequestAddress(ctx, &writable); + } + + ValueType = NewPointer(ValueType, !writable); Init = new FxTypeCast(Init, ValueType, false); SAFE_RESOLVE(Init, ctx); }