[Issue 10592] New: Regression of overloaded template function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 10 03:21:19 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10592
Summary: Regression of overloaded template function
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: regression
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: zan77137 at nifty.com
--- Comment #0 from SHOO <zan77137 at nifty.com> 2013-07-10 03:21:17 PDT ---
This code doesn't work in dmd git head master:
--------------
struct A(E)
{
void put()(const(E)[] data)
{ pragma(msg, "hit 1"); }
void put()(const(dchar)[] data) if (!is(E == dchar))
{ pragma(msg, "hit 2"); }
void put(C)(const(C)[] data) if (!is(C == dchar) && !is(E == C))
{ pragma(msg, "hit 3"); }
}
void main()
{
A!char x;
x.put("abcde"c); // OK: hit 1
x.put("abcde"w); // NG: this should hit 3
x.put("abcde"d); // OK: hit 2
}
--------- RESULT -----------
$ dmd -run main
hit 1
hit 2
main.d(12): Error: template main.A!char.A.put does not match any function
templa
te declaration. Candidates are:
main.d(3): main.A!char.A.put()(const(E)[] data)
main.d(4): main.A!char.A.put()(const(dchar)[] data) if (!is(E == dchar))
main.d(5): main.A!char.A.put(C)(const(C)[] data) if (!is(C == dchar) &&
!
is(E == C))
main.d(12): Error: template main.A!char.A.put()(const(E)[] data) cannot deduce
t
emplate function from argument types !()(immutable(wchar)[])
--
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