www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11194] New: std.container.Array.reserve calls opAssign on uninitialized data

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11194

           Summary: std.container.Array.reserve calls opAssign on
                    uninitialized data
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: sludwig outerproduct.org


--- Comment #0 from Sönke Ludwig <sludwig outerproduct.org> 2013-10-08 04:54:44
PDT ---
The following test case fails:

---
import std.container;

struct S {
    int i = 1337;
    void opAssign(S other)
    {
        assert(i == 1337);
    }
}

void main()
{
    Array!S arr;
    arr ~= S.init;
}
---

The same applies for "~this() { assert(i == 1337); }" instead of defining
opAssign.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11194



--- Comment #1 from Sönke Ludwig <sludwig outerproduct.org> 2013-10-08 08:18:55
PDT ---
Git HEAD requires a slightly extended test case:

---
import std.container;

struct S {
    int i = 1337;
    void* p;
    this(this) { assert(i == 1337); }
    ~this() { assert(i == 1337); }
}

void main()
{
    Array!S arr;
    S s;
    arr ~= s;
    arr ~= s;
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11194


Sönke Ludwig <sludwig outerproduct.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from Sönke Ludwig <sludwig outerproduct.org> 2013-10-08 08:29:20
PDT ---
Pull request: https://github.com/D-Programming-Language/phobos/pull/1620

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11194



--- Comment #3 from github-bugzilla puremagic.com 2013-10-09 08:18:47 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/5aac4a007adff938e5326675a039489c77c74ee6
fix issue 11194 - std.container.Array.reserve calls opAssign on uninitialized
data

https://github.com/D-Programming-Language/phobos/commit/4b024858a81e607214c96dc10a024d25f4af5798
Merge pull request #1620 from s-ludwig/fix_11194

fix issue 11194 - std.container.Array.reserve calls opAssign on uninitia...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 09 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11194


Sönke Ludwig <sludwig outerproduct.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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