www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15263] New: Cannot insert range into DList

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

          Issue ID: 15263
           Summary: Cannot insert range into DList
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: ryan rcorre.net

import std.range, std.container;

unittest {
  auto r = iota(0,5);
  SList!int slist;
  DList!int dlist;

  slist.insert(r); // passes
  dlist.insert(r); // fails
}

You can insert a range into an SList, but not a DList.

usr/include/dlang/dmd/std/container/dlist.d(683): Error: template
std.container.dlist.DList!int.DList.createNode cannot deduce function from
argument types !()(int), candidates are:
/usr/include/dlang/dmd/std/container/dlist.d(166):       
std.container.dlist.DList!int.DList.createNode(Stuff)(ref Stuff arg, BaseNode*
prev = null, BaseNode* next = null)
/usr/include/dlang/dmd/std/container/dlist.d(688): Error: template
std.container.dlist.DList!int.DList.createNode cannot deduce function from
argument types !()(int, BaseNode*), candidates are:
/usr/include/dlang/dmd/std/container/dlist.d(166):       
std.container.dlist.DList!int.DList.createNode(Stuff)(ref Stuff arg, BaseNode*
prev = null, BaseNode* next = null)
/usr/include/dlang/dmd/std/container/dlist.d(653): Error: template instance
std.container.dlist.DList!int.DList.createRange!(Result) error instantiating
/usr/include/dlang/dmd/std/container/dlist.d(414):        instantiated from
here: insertBeforeNode!(Result)
phobos_dlist_bug.d(9):        instantiated from here: insertBack!(Result)
Failed: ["dmd", "-Isrc", "-main", "-unittest", "-debug", "-g", "-v", "-o-",
"phobos_dlist_bug.d", "-I."]

--
Oct 29 2015