Thread overview
[Issue 9518] New: With DList of pointers, insertBack matches multiple templates.
Feb 16, 2013
entheh@cantab.net
Feb 16, 2013
entheh@cantab.net
Apr 11, 2013
Kenji Hara
February 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9518

           Summary: With DList of pointers, insertBack matches multiple
                    templates.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: entheh@cantab.net


--- Comment #0 from entheh@cantab.net 2013-02-16 05:46:31 PST ---
For example:

struct STRUCT {
   int field;
}

DList!(STRUCT*) list;

STRUCT struct;

//This works:
list.insertBack(null);
list.back=struct;

//This doesn't:
list.insertBack(&struct);

The error is along the lines of:

Error: template std.container.DList!(STRUCT*).DList.insertBeforeNode matches
more than one template declaration,
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container.d(2054):insertBeforeNode(Stuff)(Node*
n, Stuff stuff) if (isInputRange!(Stuff) &&
isImplicitlyConvertible!(ElementType!(Stuff), T)) and
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container.d(2113):insertBeforeNode(Stuff)(Node*
n, Stuff stuff) if (isImplicitlyConvertible!(Stuff, T))

Looks as if it accidentally matches the range-adding insertBack function as well as the single-entry-adding function.

(I haven't directly tested this example - I just encountered it in a bigger project. Apologies if I've got something wrong in the example.)

I don't know enough about the stuff involved to fix this. Hopefully someone who knows D better can figure out a good fix, either in the compiler or in Phobos. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9518



--- Comment #1 from entheh@cantab.net 2013-02-16 05:47:53 PST ---
I meant of course:

list.back = &struct;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9518


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-10 22:01:32 PDT ---
*** This issue has been marked as a duplicate of issue 9539 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------