[Issue 14797] New: template with inout parameter `foo(String: inout(CharT)[], CharT)` should be implicitly instanciated as foo!(char[], char)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 12 22:56:07 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14797
Issue ID: 14797
Summary: template with inout parameter `foo(String:
inout(CharT)[], CharT)` should be implicitly
instanciated as foo!(char[], char)
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ttanjo at gmail.com
In the following code, foo(String: inout(CharT)[], CharT) should be implicitly
instanciated as foo!(char[], char) but it does not.
I checked it doesn't work with dmd trunk v2.068-devel-4bc3d3d on Mac OSX.
----
inout(dchar)[] foo(String: inout(CharT)[], CharT)(String str)
{
return typeof(return).init;
}
void main()
{
char[] str = "str".dup;
auto b = foo!(inout(char)[], char)(str); // it works
auto a = foo(str); // it doesn't work but it should
}
----
Output:
error.d(10): Error: template error.foo cannot deduce function from argument
types !()(char[]), candidates are:
error.d(1): error.foo(String : inout(CharT)[], CharT)(String str)
P.S. Its severity may be `enhancement` instead of normal.
--
More information about the Digitalmars-d-bugs
mailing list