From 0fe7297fba371ccad14bd3a1c77d1c8ae0f66950 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 16 Oct 2008 22:36:26 +0200 Subject: [PATCH] Add missing case to DtoAssign for T[n] = T[]. Fixes downs' initializer bug. --- gen/llvmhelpers.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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())