Bug 10592 – Regression of overloaded template function

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-10T03:21:00Z
Last change time
2013-07-11T20:50:03Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
zan77137

Comments

Comment #0 by zan77137 — 2013-07-10T03:21:17Z
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)[])
Comment #1 by k.hara.pg — 2013-07-10T06:11:08Z
Comment #2 by github-bugzilla — 2013-07-11T01:16:47Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/89e1796d011847494c160db8cb90792765fc4e58 fix Issue 10592 - Regression of overloaded template function https://github.com/D-Programming-Language/dmd/commit/338caccfb595c58171215fb4a5930bd23491e64c Merge pull request #2332 from 9rnsr/fix10592 [REG2.064a] Issue 10592 - Regression of overloaded template function