[Issue 1528] [tdpl] overloading template and non-template functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 25 02:16:06 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=1528
timon.gehr at gmx.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |timon.gehr at gmx.ch
--- Comment #13 from timon.gehr at gmx.ch 2013-02-25 02:15:54 PST ---
(In reply to comment #12)
> ...
>
> Therefore, I'd ask question again to Walter: how does above cases behave?
I have implemented it in accordance with TDPL, and the following behaviour
results:
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); // error: ambiguous
f1(1L); // error: ambiguous
f2(1); // error: ambiguous
f2(1L); // error: no match
static assert(f3(1)==1);
static assert(f3(1L)==2);
static assert(f4(1)==1);
static assert(f4(1L)==1);
static assert(f5(1)==1);
static assert(f5(1L)==1);
static assert(f6(1)==1);
static assert(f6(1L)==1);
}
--
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