mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-31 03:53:14 +01:00
Fixed dynamic array -> boolean. does (arr.ptr !is null) now instead of (arr.length != 0)
This commit is contained in:
@@ -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)
|
||||
|
||||
5
tests/mini/strings2.d
Normal file
5
tests/mini/strings2.d
Normal file
@@ -0,0 +1,5 @@
|
||||
void main()
|
||||
{
|
||||
char[] s = "";
|
||||
assert(s);
|
||||
}
|
||||
Reference in New Issue
Block a user