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); 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) 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(); } diff --git a/src/s2ir.c b/src/s2ir.c index 08d802bc4e9b..8be00605ea0d 100644 --- a/src/s2ir.c +++ b/src/s2ir.c @@ -1247,11 +1247,15 @@ 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) { 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);