Fixed dynamic array -> boolean. does (arr.ptr !is null) now instead of (arr.length != 0)

This commit is contained in:
Tomas Lindquist Olsen 2008-10-08 22:38:52 +02:00
parent 4d610bcd7e
commit ed7dd481e5
2 changed files with 9 additions and 2 deletions

View file

@ -1562,8 +1562,10 @@ LLValue* DtoBoolean(Loc& loc, DValue* dval)
// dynamic array
else if (ty == Tarray)
{
// return (arr.length != 0)
return gIR->ir->CreateICmpNE(DtoArrayLen(dval), DtoConstSize_t(0), "tmp");
// return (arr.ptr !is null)
LLValue* ptr = DtoArrayPtr(dval);
LLConstant* nul = getNullPtr(ptr->getType());
return gIR->ir->CreateICmpNE(ptr, nul, "tmp");
}
// delegate
else if (ty == Tdelegate)