Handle typeof(null) -> Object conversion.

Not sure why this wasn't triggered by the test suite before.
This commit is contained in:
David Nadlinger
2013-10-13 05:48:27 +02:00
parent 787c147986
commit 8ead24a2bb

View File

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