From eb96b8ab446eb3aa60f776706d213c978a3ce9ab Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Mon, 27 Jul 2015 21:05:30 +0200 Subject: [PATCH] arrays: Disalllow void array block assignment --- gen/arrays.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 5d56471206..45fbf13440 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -263,7 +263,18 @@ void DtoArrayAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPost LLValue* lhsLength = DtoArrayLen(lhs); // TODO: This should use AssignExp::ismemset. - if (!t2->implicitConvTo(t->nextOf())) + // Disallow void array block assignment (DMD issue 7493). + bool canBeBlockAssignment = true; + if (!rhs->isNull()) + { + Type *leafElemType = elemType; + while (leafElemType->ty == Tarray) + { + leafElemType = leafElemType->nextOf(); + } + canBeBlockAssignment = leafElemType->ty != Tvoid; + } + if (!t2->implicitConvTo(t->nextOf()) || !canBeBlockAssignment) { // T[] = T[] T[] = T[n] // T[n] = T[n] T[n] = T[]