[Issue 1528] [tdpl] overloading template and non-template functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 24 21:32:18 PST 2013


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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pull                        |


--- Comment #10 from Kenji Hara <k.hara.pg at gmail.com> 2013-02-24 21:32:10 PST ---
(In reply to comment #9)
> https://github.com/D-Programming-Language/dmd/pull/1409

By implementing it, I found some corner cases. How should these behave?

int f1(int a, double=10) { return 1; }
int f1(int a, string="") { return 2; }

int f2(T:int)(T b, double=10) { return 1; }
int f2(T:int)(T b, string="") { return 2; }

// vs deduced parameter
int f3(int a) { return 1; }
int f3(T)(T b) { return 2; }

// vs specialized parameter
int f4(int a) { return 1; }
int f4(T:int)(T b) { return 2; }

// vs deduced parameter + template constraint (1)
int f5(int a) { return 1; }
int f5(T)(T b) if (is(T == int)) { return 2; }

// vs deduced parameter + template constraint (2)
int f6(int a) { return 1; }
int f6(T)(T b) if (is(T : int)) { return 2; }

void main()
{
    f1(1);  // ambiguous error
    f1(1L); // ambiguous error

    f2(1);  // ambiguous error
    f2(1L); // ambiguous error

    f3(1);  // ?
    f3(1L); // ?

    f4(1);  // ?
    f4(1L); // ?

    f5(1);  // ?
    f5(1L); // ?

    f6(1);  // ?
    f6(1L); // ?
}

-- 
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