From c623c7982131fc7ed0f53493ec50d3422a042eb0 Mon Sep 17 00:00:00 2001 From: k-hara Date: Sun, 27 Feb 2011 16:12:15 +0900 Subject: [PATCH 1/5] Issue 4499 - calls to @disabled postblit are emitted --- src/s2ir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/s2ir.c b/src/s2ir.c index 08d802bc4e9b..95991b6ffc1a 100644 --- a/src/s2ir.c +++ b/src/s2ir.c @@ -1252,6 +1252,10 @@ void ReturnStatement::toIR(IRState *irs) { 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"); + } elem *ec = el_var(irs->shidden); ec = callfunc(loc, irs, 1, Type::tvoid, ec, tb->pointerTo(), fd, fd->type, NULL, NULL); es = el_bin(OPcomma, ec->Ety, es, ec); From 336272c429436d75f1e32c6a28815e0ffe94b717 Mon Sep 17 00:00:00 2001 From: k-hara Date: Thu, 3 Mar 2011 03:00:21 +0900 Subject: [PATCH 2/5] Issue 5362 - checking $ in bracket is broken --- src/parse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parse.c b/src/parse.c index ac1945874742..65d6347e3fb0 100644 --- a/src/parse.c +++ b/src/parse.c @@ -5432,6 +5432,7 @@ Expression *Parser::parsePostExp(Expression *e) nextToken(); if (token.value == TOKrbracket) { // array[] + inBrackets--; e = new SliceExp(loc, e, NULL, NULL); nextToken(); } From 64cc7f823195fa002cec978563a4bb8258ac93d5 Mon Sep 17 00:00:00 2001 From: k-hara Date: Thu, 3 Mar 2011 02:57:39 +0900 Subject: [PATCH 3/5] Issue 5178 - StructLiteral should not be lvalue --- src/expression.c | 8 +------- src/expression.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/expression.c b/src/expression.c index d3a6e2d5342e..08cb0140842e 100644 --- a/src/expression.c +++ b/src/expression.c @@ -3470,16 +3470,10 @@ int StructLiteralExp::getFieldIndex(Type *type, unsigned offset) #if DMDV2 int StructLiteralExp::isLvalue() { - return 1; + return 0; } #endif -Expression *StructLiteralExp::toLvalue(Scope *sc, Expression *e) -{ - return this; -} - - int StructLiteralExp::checkSideEffect(int flag) { int f = 0; diff --git a/src/expression.h b/src/expression.h index ae36b79125e0..95d66a998b22 100644 --- a/src/expression.h +++ b/src/expression.h @@ -473,7 +473,6 @@ struct StructLiteralExp : Expression Expression *interpret(InterState *istate); dt_t **toDt(dt_t **pdt); int isLvalue(); - Expression *toLvalue(Scope *sc, Expression *e); int canThrow(bool mustNotThrow); MATCH implicitConvTo(Type *t); From cb37a55307e8d9f42b35e95460ce028f75cd9cf1 Mon Sep 17 00:00:00 2001 From: k-hara Date: Thu, 3 Mar 2011 02:53:10 +0900 Subject: [PATCH 4/5] Issue 5080 - breaking const-correctness with class/interface --- src/mtype.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mtype.c b/src/mtype.c index f35fd279eb25..e99f54801813 100644 --- a/src/mtype.c +++ b/src/mtype.c @@ -7620,7 +7620,10 @@ MATCH TypeClass::implicitConvTo(Type *to) ClassDeclaration *cdto = to->isClassHandle(); if (cdto && cdto->isBaseOf(sym, NULL)) { //printf("'to' is base\n"); - return MATCHconvert; + if (MODimplicitConv(mod, to->mod)) // Fixes bug5080 + return MATCHconvert; + else + return MATCHnomatch; } if (global.params.Dversion == 1) From d14cfcf0ce49daab016d87be96e0fbd769b80e56 Mon Sep 17 00:00:00 2001 From: k-hara Date: Sun, 27 Feb 2011 16:13:03 +0900 Subject: [PATCH 5/5] Issue 4437 - copy construction bug with "return this;" --- src/s2ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s2ir.c b/src/s2ir.c index 95991b6ffc1a..8be00605ea0d 100644 --- a/src/s2ir.c +++ b/src/s2ir.c @@ -1247,7 +1247,7 @@ void ReturnStatement::toIR(IRState *irs) */ Type *tb = exp->type->toBasetype(); //if (tb->ty == Tstruct) exp->dump(0); - 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)