D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15263 - [REG2.067.0] Cannot insert range into DList
Summary: [REG2.067.0] Cannot insert range into DList
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-30 01:25 UTC by ryan
Modified: 2015-11-07 02:32 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ryan 2015-10-30 01:25:31 UTC
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."]
Comment 1 Vladimir Panteleev 2015-10-30 11:21:18 UTC
This is a regression.

Introduced in https://github.com/D-Programming-Language/phobos/pull/2457
Comment 2 Yuxuan Shui 2015-11-06 01:02:02 UTC
Looks like we just need to make DList.createNode an auto ref function?
Comment 3 ryan 2015-11-07 02:32:16 UTC
(In reply to Yuxuan Shui from comment #2)
> Looks like we just need to make DList.createNode an auto ref function?

Correct, and this was actually fixed by https://github.com/D-Programming-Language/phobos/pull/3787#issuecomment-152760223. I'll go ahead and close.