mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

For expression `new int[][][](2, 2)` the relevant element type is `int[]` and not `int`, because only two dimensions are allocated.
21 lines
595 B
D
21 lines
595 B
D
import core.memory;
|
|
|
|
void main()
|
|
{
|
|
{
|
|
int[][] a = new int[][](2, 2);
|
|
assert(!(GC.getAttr(a.ptr) & GC.BlkAttr.NO_SCAN));
|
|
assert(GC.getAttr(a[0].ptr) & GC.BlkAttr.NO_SCAN);
|
|
}
|
|
{
|
|
void*[][] a = new void*[][](2, 2);
|
|
assert(!(GC.getAttr(a.ptr) & GC.BlkAttr.NO_SCAN));
|
|
assert(!(GC.getAttr(a[0].ptr) & GC.BlkAttr.NO_SCAN));
|
|
}
|
|
{
|
|
int[][][] a = new int[][][](2, 2);
|
|
assert(!(GC.getAttr(a.ptr) & GC.BlkAttr.NO_SCAN));
|
|
assert(!(GC.getAttr(a[0].ptr) & GC.BlkAttr.NO_SCAN));
|
|
assert(a[0][0].ptr is null);
|
|
}
|
|
}
|