Bug 10641 – array alloc missing APPENDABLE/capacity info
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-14T09:32:48Z
Last change time
2018-11-23T10:04:29Z
Assigned to
No Owner
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2013-07-14T09:32:48Z
When allocating for an array, only the last dimension will have D-array semantics, with capacity info. When allocating an array via new, ALL dimensions should have appendable info associated.
//----
void main()
{
alias T0 = ushort;
auto s0 = new T0[](10);
assert(s0.capacity); //OK
alias T1 = ushort;
auto s1 = new T1[][](10, 10);
foreach (e; s1)
assert(e.capacity); //OK
assert(s1.capacity); //FAILS
alias T2 = ushort[];
auto s2 = new T2[][](10, 10);
foreach (e; s2)
assert(e.capacity); //OK
assert(s2.capacity); //FAILS
alias T3 = ushort;
auto s3 = new T3[][][](10, 10, 10);
foreach (e; s3)
{
foreach (ee; e)
assert(ee.capacity); //OK
assert(e.capacity); //FAILS
}
assert(s2.capacity); //FAILS
}
//----
All the above "FAILS" should pass.
Comment #1 by stanislav.blinov — 2018-11-23T05:24:38Z
Doesn't seem do be an issues since 2.067, though I can't seem to find what was the exact fix.