diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 90376ee9..dc03e700 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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())