changeset 1441:a3af393d1936

Error on invalid array cast. See DMD3041.
author Christian Kamm <kamm incasoftware de>
date Sun, 31 May 2009 15:07:04 +0200
parents d7ec997de427
children 0a5f7890f327
files gen/arrays.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;