From c6e0dd9be31273b6d680ef85e0a5df6b70d6e648 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Tue, 29 Jul 2008 12:44:28 +0200 Subject: [PATCH] Fix the static array cast size check. --- gen/arrays.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/arrays.cpp b/gen/arrays.cpp index a3a42aca..fe4a444b 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -988,7 +988,7 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to) assert(isaPointer(uval->getType())); const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0)); - if(arrty->getNumElements() % totype->next->size() != 0) + if(arrty->getNumElements()*fromtype->next->size() % totype->next->size() != 0) { error(loc, "invalid cast from '%s' to '%s', the element sizes don't line up", fromtype->toChars(), totype->toChars()); fatal();