www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4632] New: Copy constructor not invoked on array reallocation

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

           Summary: Copy constructor not invoked on array reallocation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean invisibleduck.org
        ReportedBy: rsinfu gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu gmail.com> 2010-08-12 02:01:24 PDT
---
Struct copy constructor is not invoked on array copy, expansion nor
concatenation; but it should.

-------------------- array_cpctor.d
void main()
{
    auto ss = new S[](1);
    auto ssdup = ss.dup;

    // A copy is created...
    assert(&ss[0] != &ssdup[0]);

    // but the copy constructor is not invoked!
    assert(ssdup[0].copy);  // Assertion failure
}
struct S
{
    bool copy;
    this(this) { copy = true; }
}
--------------------
% dmd -run array_cpctor.d
core.exception.AssertError array_cpctor(10): Assertion failure
--------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4632


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |clugdbug yahoo.com.au
           Severity|normal                      |major


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4632



--- Comment #1 from Don <clugdbug yahoo.com.au> 2011-02-28 14:02:01 PST ---
Might be the same as bug 3475

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4632


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies gmail.com> 2011-07-09 12:26:11 EST ---
*** This issue has been marked as a duplicate of issue 3475 ***

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