diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index dad44a96..4685784c 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -19491,7 +19491,8 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup) lookupValue = BfTypedValue(mBfIRBuilder->CreateInBoundsGEP(GetThis().mValue, 0, fieldInstance->mDataIdx), fieldInstance->mResolvedType, true); else lookupValue = ExtractValue(GetThis(), fieldInstance, fieldInstance->mDataIdx); - lookupValue = LoadOrAggregateValue(lookupValue); + if (!methodInstance->mReturnType->IsRef()) + lookupValue = LoadOrAggregateValue(lookupValue); CreateReturn(lookupValue.mValue); EmitLifetimeEnds(&mCurMethodState->mHeadScope); }