[Issue 15571] New: .dup is incompatible with self referencing structs

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 16 11:42:09 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15571

          Issue ID: 15571
           Summary: .dup is incompatible with self referencing structs
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: foldenyi.tamas at gmail.com

.dup is not compatible with self-referencing structs: This code does not
compile due to the .dup operation:

template Wrapper(T) {
  struct Wrapper {
    private T[] _holder;
    this(this) {
      _holder = _holder.dup;
    }
  }
}

unittest {
  struct Node {
    Wrapper!Node next;
  };
}

--


More information about the Digitalmars-d-bugs mailing list