www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2972] New: Can't overload non-templated function against template

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

           Summary: Can't overload non-templated function against template
           Product: D
           Version: 2.030
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dsimcha yahoo.com


DMD doesn't seem to allow overloading of non-templated functions against
templated functions even when they have different arity and therefore no
ambiguity exits.  Test case:

void foo(const char[] stuff) { }

void foo(T)(const char[] stuff, const T[] moreStuff){}

C:\home\dsimcha\bin\test.d(3): Error: template test.foo(T) conflicts with
function test.foo at C:\home\dsimcha\bin\test.d(1)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2972





--- Comment #1 from David Simcha <dsimcha yahoo.com>  2009-05-13 09:29:48 PDT
---
Note:  See bug 2268.  This was fixed sometime in the last few releases, and I
think the fix for it caused this bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2972


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com
            Summary|Can't overload              |[tdpl] Can't overload
                   |non-templated function      |non-templated function
                   |against template            |against template


--- Comment #2 from Andrei Alexandrescu <andrei metalanguage.com> 2011-12-07
14:31:24 PST ---
Breaks TDPL example, stylized below:

module main;

import std.stdio;

void overloadme(uint number)
{
    writeln("This is overloadme with uint.");
}

void overloadme(long number)
{
    writeln("This is overloadme with long.");
}

void overloadme(T)(T number)
{
    writeln("Generic overloadme called.");
}

int main(string[] argv)
{
    overloadme(25);
    overloadme("Bla");

    writeln("\nFinished");
    readln();
    return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 07 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2972


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-01-21
18:21:01 PST ---
*** Issue 4573 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 21 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2972


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

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


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-01-21
18:22:11 PST ---
*** This issue has been marked as a duplicate of issue 1528 ***

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