www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13140] New: auto ref should support implicit conversion


          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 puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
void foo(T)(auto ref T t)

void bar()
    int v = 12;

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.

Jul 16 2014