Mercurial > projects > ldc
changeset 888:d8c44f1e08e1
Fix #164.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 17 Jan 2009 17:41:03 +0100 |
parents | 7f6eeb7b003e |
children | d2d6107e4ec2 |
files | dmd/optimize.c tests/mini/compile_bug164_stringinitcast.d |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/optimize.c Sat Jan 17 14:53:32 2009 +0100 +++ b/dmd/optimize.c Sat Jan 17 17:41:03 2009 +0100 @@ -352,6 +352,9 @@ type->next->equals(e1->type->next) ) { + // make a copy before adjusting type to avoid + // messing up the type of an existing initializer + e1 = e1->syntaxCopy(); e1->type = type; return e1; } @@ -362,6 +365,7 @@ if (e1->op == TOKnull && (type->ty == Tpointer || type->ty == Tclass)) { + e1 = e1->syntaxCopy(); e1->type = type; return e1; } @@ -377,6 +381,7 @@ cdto = type->isClassHandle(); if (cdto->isBaseOf(cdfrom, &offset) && offset == 0) { + e1 = e1->syntaxCopy(); e1->type = type; return e1; } @@ -391,6 +396,7 @@ if (type->size() == e1->type->size() && type->toBasetype()->ty != Tsarray) { + e1 = e1->syntaxCopy(); e1->type = type; return e1; }