diff gen/toir.cpp @ 624:eb444ed4a2d3

Make invalid compile time casts an error instead of asserting.
author Christian Kamm <kamm incasoftware de>
date Wed, 01 Oct 2008 19:15:01 +0200
parents 26fce59fe80a
children e3c46bcce65f
line wrap: on
line diff
--- 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);
 }