# HG changeset patch # User Christian Kamm # Date 1243775224 -7200 # Node ID a3af393d1936ddfc75b6d7757280a700d177cde8 # Parent d7ec997de4277fa98eacef5fc21c3cb0b90cacd7 Error on invalid array cast. See DMD3041. diff -r d7ec997de427 -r a3af393d1936 gen/arrays.cpp --- a/gen/arrays.cpp Sun May 31 14:27:01 2009 +0200 +++ b/gen/arrays.cpp Sun May 31 15:07:04 2009 +0200 @@ -894,7 +894,10 @@ 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;