Error on invalid array cast. See DMD3041.

This commit is contained in:
Christian Kamm
2009-05-31 15:07:04 +02:00
parent a517adb426
commit 78aa98fdfb

View File

@@ -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;