mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-16 11:53:13 +01:00
Fix dmd bug 7504: Cannot assign an object of type 'typeof(null)' to an array
This commit is contained in:
@@ -748,6 +748,15 @@ DValue* DtoCastNull(Loc& loc, DValue* val, Type* to)
|
||||
LLValue *rval = DtoBitCast(val->getRVal(), tolltype);
|
||||
return new DImValue(to, rval);
|
||||
}
|
||||
if (totype->ty == Tarray)
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast null to array: " << *tolltype << '\n';
|
||||
LLValue *rval = val->getRVal();
|
||||
rval = DtoBitCast(rval, DtoType(to->nextOf()->pointerTo()));
|
||||
rval = DtoAggrPair(DtoConstSize_t(0), rval, "null_array");
|
||||
return new DImValue(to, rval);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(loc, "invalid cast from null to '%s'", to->toChars());
|
||||
|
||||
Reference in New Issue
Block a user