[Issue 13140] New: auto ref should support implicit conversion
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 16 05:39:56 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13140
Issue ID: 13140
Summary: auto ref should support implicit conversion
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
void foo(T)(auto ref T t)
{
}
void bar()
{
int v = 12;
foo!long(v);
}
CODE
----
dmd -c bug
----
bug.d(8): Error: template bug.foo cannot deduce function from argument types
!(long)(int), candidates are:
bug.d(1): bug.foo(T)(auto ref T t)
----
The compiler seems to reject this because it tries to bind the lvalue argument
via reference. IMO implicit conversion of arguments types should be run before
determining lvalueness to resolve this.
--
More information about the Digitalmars-d-bugs
mailing list