www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15571] New: .dup is incompatible with self referencing structs

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 puremagic.com
          Reporter: foldenyi.tamas 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;
  };
}

--
Jan 16