From 78aa98fdfbe3faacd562759e0862692972b7c203 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sun, 31 May 2009 15:07:04 +0200 Subject: [PATCH] Error on invalid array cast. See DMD3041. --- gen/arrays.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 3da0d4e1..7818952e 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -894,7 +894,10 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to) Type* totype = to->toBasetype(); Type* fromtype = u->getType()->toBasetype(); - assert(fromtype->ty == Tarray || fromtype->ty == Tsarray); + if (fromtype->ty != Tarray && fromtype->ty != Tsarray) { + error(loc, "can't cast %s to %s", u->getType()->toChars(), to->toChars()); + fatal(); + } LLValue* rval; LLValue* rval2;