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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 28 14:16:10 PDT 2013


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #38 from bearophile_hugs at eml.cc 2013-06-28 14:16:04 PDT ---
(In reply to comment #37)
> Commits pushed to master at 

This is a significant improvement.

I am testing this feature a little. This is code reduced from your Comment 10:


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; }
void main() {
    f1(1);
    f2(1L);
}


It gives the errors:

test.d(6): Error: called with argument types:
    (int)
matches both:
    test.d(1): test.f1(int a, double _param_1 = 10.0000)
and:
    test.d(2): test.f1(int a, string _param_1 = "")
test.d(7): Error: template test.f2 does not match any function template
declaration. Candidates are:
test.d(3):        test.f2(T : int)(T b, double = 10)
test.d(4):        test.f2(T : int)(T b, string = "")
test.d(7): Error: template test.f2(T : int)(T b, double = 10) cannot deduce
template function from argument types !()(long)


For the error at line 6 it nicely indents the lines test.d(1) and test.d(2).

While for the error at line 7 it doesn't indent the lines test.d(3) and
test.d(4).

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