# HG changeset patch # User Christian Kamm # Date 1222881301 -7200 # Node ID eb444ed4a2d38e684ce112963e70e7fe7b6bdfe1 # Parent fe3c7af578ebde7c70df4333195de17f1f6d8d74 Make invalid compile time casts an error instead of asserting. diff -r fe3c7af578eb -r eb444ed4a2d3 gen/toir.cpp --- a/gen/toir.cpp Wed Oct 01 18:33:21 2008 +0200 +++ b/gen/toir.cpp Wed Oct 01 19:15:01 2008 +0200 @@ -829,10 +829,12 @@ LOG_SCOPE; LLConstant* c = e1->toConstElem(p); - assert(isaPointer(c->getType())); - const LLType* lltype = DtoType(type); - assert(isaPointer(lltype)); + + if(!isaPointer(c->getType()) || !isaPointer(lltype)) { + error("can only cast pointers to pointers at compile time, not %s to %s", type->toChars(), e1->type->toChars()); + fatal(); + } return llvm::ConstantExpr::getBitCast(c, lltype); }