www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3576] New: Can't overload explicitly instantiated template functions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3576

           Summary: Can't overload explicitly instantiated template
                    functions
           Product: D
           Version: future
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



Broken in 2.037, works in 2.036:

void foo(T)(T arg) {}
void foo(T)(T arg, uint bar) {}

void main() {
    foo(1);          // works
    foo(1, 2);       // works
    foo!(uint)(1);   // Error: template instance foo!(uint) matches
                     // more than one template declaration, foo(T) and foo(T)

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 05 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3576


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WONTFIX



03:08:42 PST ---
I know there was this change, but before it was a bit erratic what it did. I'll
argue that the compiler is correctly saying it's an error.

Code can decide to do template function type inference, or overloading, but not
both at the same time. By not specifying enough in the specialization, then
inference rules are applied.

Trying to do both inference and overloading results in a complicated morass.
Better to leave it an error.

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