Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion src/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -5432,6 +5432,7 @@ Expression *Parser::parsePostExp(Expression *e)
nextToken();
if (token.value == TOKrbracket)
{ // array[]
inBrackets--;
e = new SliceExp(loc, e, NULL, NULL);
nextToken();
}
Expand Down
6 changes: 5 additions & 1 deletion src/s2ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down