www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13151] New: std.range.take template constraint ambiguity

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

          Issue ID: 13151
           Summary: std.range.take template constraint ambiguity
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

unittest
{
    auto r = take(repeat(1, 4), 3);
    assert(r.equal(repeat(1, 3)));
}

fails to compile due to typeof(r) satisfying both

isInputRange!(Unqual!R) && !isInfinite!(Unqual!R) && hasSlicing!(Unqual!R) 

and

is(R T == Take!T)


Note that this isn't triggered by using an array. is(typeof(take(slice)) ==
typeof(slice))

--
Jul 17 2014