www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13807] New: inout(T)[] no longer matches string[]

https://issues.dlang.org/show_bug.cgi?id=13807

          Issue ID: 13807
           Summary: inout(T)[] no longer matches string[]
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

/////////////////// test.d //////////////////
inout(T) sample(T)(inout(T)[] arr)
{
    return arr[0];
}

void main()
{
    auto n = sample([7, 7, 7]);      // OK
    auto s = sample(["foo", "bar"]); // Error
}
/////////////////////////////////////////////

test.d(9): Error: template test.sample cannot deduce function from argument
types !()(string[]), candidates are:
test.d(1):        test.sample(T)(inout(T)[] arr)

Introduced in https://github.com/D-Programming-Language/dmd/pull/3896

--
Dec 02 2014