mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-15 04:13:14 +01:00
Handle typeof(null) -> Object conversion.
Not sure why this wasn't triggered by the test suite before.
This commit is contained in:
@@ -737,10 +737,10 @@ DValue* DtoCastNull(Loc& loc, DValue* val, Type* to)
|
||||
Type* totype = to->toBasetype();
|
||||
LLType* tolltype = DtoType(to);
|
||||
|
||||
if (totype->ty == Tpointer)
|
||||
if (totype->ty == Tpointer || totype->ty == Tclass)
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast null to pointer: " << *tolltype << '\n';
|
||||
Logger::cout() << "cast null to pointer/class: " << *tolltype << '\n';
|
||||
LLValue *rval = DtoBitCast(val->getRVal(), tolltype);
|
||||
return new DImValue(to, rval);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user