Bug 16885 – Cannot deduce function from argument type when mixing template instantiation and implicit convertion

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-12-01T12:50:46Z
Last change time
2024-12-13T18:50:52Z
Assigned to
No Owner
Creator
Mathias Lang
Moved to GitHub: dmd#19211 →

Comments

Comment #0 by mathias.lang — 2016-12-01T12:50:46Z
Sorry for the very generic title, didn't knew how to put it. This snippet should compile: ``` T[] tail (T) (T[] v, in T[] i, out T[] o) { return v; } void main () { const(char)[] p1, p2; immutable(char)[] pi; tail(p1, pi, p2); } ``` As there is one possible instantiation for tail, which is `T=const(char)`. But here the compiler fails to see it and spit out: ``` lol.d(11): Error: template lol.tail cannot deduce function from argument types !()(const(char)[], string, const(char)[]), candidates are: lol.d(1): lol.tail(T)(T[] v, in T[] i, out T[] o) ```
Comment #1 by uplink.coder — 2016-12-02T00:47:01Z
works as intended. Template types must no coerce.
Comment #2 by robert.schadek — 2024-12-13T18:50:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19211 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB