From 063020fae6da3152ea134fde3f724444c9d4558f Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Sun, 27 Feb 2011 12:27:38 +0300 Subject: [PATCH] Don't run postblit on references --- gen/statements.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gen/statements.cpp b/gen/statements.cpp index 4333fa06..5361b126 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -96,7 +96,7 @@ void ReturnStatement::toIR(IRState* p) DtoAssign(loc, rvar, e); // call postblit if necessary - if (e->isLVal()) + if (e->isLVal() && !p->func()->type->isref) callPostblitHelper(loc, exp, e->getLVal()); // emit scopes @@ -118,7 +118,8 @@ void ReturnStatement::toIR(IRState* p) DValue* dval = exp->toElem(p); // call postblit if necessary - callPostblitHelper(loc, exp, dval->getRVal()); + if (!p->func()->type->isref) + callPostblitHelper(loc, exp, dval->getRVal()); if (!exp && (p->topfunc() == p->mainFunc)) v = LLConstant::getNullValue(p->mainFunc->getReturnType());