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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 5 10:50:18 PST 2009


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 at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at 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: -------


More information about the Digitalmars-d-bugs mailing list