[Issue 10593] array's reserve/capacity go haywire if length has been changed prior

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 20 09:58:51 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10593


Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at dawg.eu


--- Comment #3 from Martin Nowak <code at dawg.eu> 2013-07-20 09:58:49 PDT ---
It seems that reserve doesn't update the capacity.
If bug 6372 is not the reason for this you might want to look at the array
blockinfo cache.

reduced test case
---
cat > bug.d << CODE
void main()
{
    enum M = 4079;
    ubyte[] a = new ubyte[](M - 1);
    a ~= 1;
    immutable u = a.reserve(M+1);
    assert(u == a.capacity);
}
CODE
dmd -run bug
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list