Mercurial > projects > ldc
diff dmd/optimize.c @ 888:d8c44f1e08e1
Fix #164.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 17 Jan 2009 17:41:03 +0100 |
parents | 330f999ade44 |
children | e74e2e53ba3b |
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; }