From ce799e99747f427306de97053941b4d615047f8d Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 19 Jul 2011 19:20:43 +0400 Subject: [PATCH] Fixed postblit call --- gen/statements.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gen/statements.cpp b/gen/statements.cpp index d8db4e70..3ac3641e 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -52,12 +52,14 @@ static void callPostblitHelper(Loc &loc, Expression *exp, LLValue *val) { Type *tb = exp->type->toBasetype(); - if ((exp->op == TOKvar || exp->op == TOKdotvar || exp->op == TOKstar) && + if ((exp->op == TOKvar || exp->op == TOKdotvar || exp->op == TOKstar || exp->op == TOKthis) && tb->ty == Tstruct) { StructDeclaration *sd = ((TypeStruct *)tb)->sym; if (sd->postblit) { FuncDeclaration *fd = sd->postblit; + if (fd->storage_class & STCdisable) + fd->toParent()->error(loc, "is not copyable because it is annotated with @disable"); fd->codegen(Type::sir); Expressions args; DFuncValue dfn(fd, fd->ir.irFunc->func, val); @@ -98,8 +100,8 @@ void ReturnStatement::toIR(IRState* p) #if DMDV2 // call postblit if necessary - if (e->isLVal() && !p->func()->type->isref) - callPostblitHelper(loc, exp, e->getLVal()); + if (!p->func()->type->isref) + callPostblitHelper(loc, exp, rvar->getLVal()); #endif // emit scopes