Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 624:eb444ed4a2d3

Show
Ignore:
Timestamp:
10/01/08 13:15:01 (2 months ago)
Author:
Christian Kamm <kamm incasoftware de>
branch:
default
Message:

Make invalid compile time casts an error instead of asserting.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gen/toir.cpp

    r622 r624  
    830830 
    831831    LLConstant* c = e1->toConstElem(p); 
    832     assert(isaPointer(c->getType())); 
    833  
    834832    const LLType* lltype = DtoType(type); 
    835     assert(isaPointer(lltype)); 
     833 
     834    if(!isaPointer(c->getType()) || !isaPointer(lltype)) { 
     835        error("can only cast pointers to pointers at compile time, not %s to %s", type->toChars(), e1->type->toChars()); 
     836        fatal(); 
     837    } 
    836838 
    837839    return llvm::ConstantExpr::getBitCast(c, lltype); 
Copyright © 2008, LDC Development Team.