mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
Fixed dynamic array -> boolean. does (arr.ptr !is null) now instead of (arr.length != 0)
This commit is contained in:
parent
4d610bcd7e
commit
ed7dd481e5
2 changed files with 9 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue