www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3475] New: .dup does not call this(this) for elements

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

           Summary: .dup does not call this(this) for elements
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrei metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei metalanguage.com> 2009-11-05
10:50:17 PST ---
struct Widget {
   private int[] array;
   this(uint length) {
      array = new int[length];
   }
   this(this) {
      array = array.dup;
   }
}

void main() {
    auto a = new Widget[1];
    a[0] = Widget(10);
    auto b = a.dup;
    assert(b[0].array !is a[0].array);
}

The code fails. It should pass.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 05 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3475



--- Comment #1 from Don <clugdbug yahoo.com.au> 2011-02-28 14:03:02 PST ---
Bug 4632 is probably a duplicate.

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