[Issue 9518] New: With DList of pointers, insertBack matches multiple templates.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 16 05:46:33 PST 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 at puremagic.com
        ReportedBy: entheh at cantab.net


--- Comment #0 from entheh at 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: -------


More information about the Digitalmars-d-bugs mailing list