Add missing case to DtoAssign for T[n] = T[]. Fixes downs' initializer bug.

This commit is contained in:
Christian Kamm
2008-10-16 22:36:26 +02:00
parent 6c532ac149
commit 0fe7297fba

View File

@@ -450,12 +450,20 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs)
}
}
else if (t->ty == Tsarray) {
// T[n] = T[n]
if (DtoType(lhs->getType()) == DtoType(rhs->getType())) {
DtoStaticArrayCopy(lhs->getLVal(), rhs->getRVal());
}
else {
// T[n] = T
else if (t->next->toBasetype()->equals(t2)) {
DtoArrayInit(loc, lhs, rhs);
}
// T[n] = T[] - generally only generated by frontend in rare cases
else if (t2->ty == Tarray && t->next->toBasetype()->equals(t2->next->toBasetype())) {
DtoMemCpy(lhs->getLVal(), DtoArrayPtr(rhs), DtoArrayLen(rhs));
} else {
assert(0 && "Unimplemented static array assign!");
}
}
else if (t->ty == Tdelegate) {
if (rhs->isNull())