www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9927] New: Compiler tries to instantiate template even though a symbol conflict occurred

http://d.puremagic.com/issues/show_bug.cgi?id=9927

           Summary: Compiler tries to instantiate template even though a
                    symbol conflict occurred
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



03:19:20 PDT ---
-------
module test;
import std.algorithm;
import foo;

void main()
{
    class C { }
    C[] c;
    c.remove(new C);
}
-------

-------
module foo;
void remove(T)(T[], T) { }
-------

2.063:
$ dmd -c test.d

-------
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7412): Error:
function object.Object.opCmp (Object o) is not callable using argument types
(uint)
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7413): Error:
function object.Object.opCmp (Object o) is not callable using argument types
(uint)
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7413): Warning:
statement is not reachable
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7418): Warning:
statement is not reachable
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7419): Warning:
statement is not reachable
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7420): Warning:
statement is not reachable
test.d(9): Error: template instance std.algorithm.remove!(cast(SwapStrategy)2,
C[], C) error instantiating
test.d(9): Error: foo.remove!(C).remove at foo.d(2) conflicts with
std.algorithm.remove!(cast(SwapStrategy)2, C[], C).remove at
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7391)
-------

Note the last error message, which is the only error message it should show:

-------
test.d(9): Error: foo.remove!(C).remove at foo.d(2) conflicts with
std.algorithm.remove!(cast(SwapStrategy)2, C[], C).remove at
C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7391)
-------

If there is a conflic, the compiler should not attempt to instantiate the
template which is causing all these diagnostics.

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