changeset 709:b972fb129d37

Add missing case to DtoAssign for T[n] = T[]. Fixes downs' initializer bug.
author Christian Kamm <kamm incasoftware de>
date Thu, 16 Oct 2008 22:36:26 +0200
parents fd5665da3a27
children 20a5180f2e80
files gen/llvmhelpers.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Thu Oct 16 22:07:02 2008 +0200
+++ b/gen/llvmhelpers.cpp	Thu Oct 16 22:36:26 2008 +0200
@@ -450,12 +450,20 @@
         }
     }
     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())