Bug 13151 – std.range.take template constraint ambiguity

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-17T10:59:00Z
Last change time
2014-07-17T14:06:10Z
Assigned to
nobody
Creator
john.loughran.colvin

Comments

Comment #0 by john.loughran.colvin — 2014-07-17T10:59:23Z
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))
Comment #1 by john.loughran.colvin — 2014-07-17T11:08:28Z
woops, that should be unittest { auto r = take(repeat(1, 4), 3); assert(r.take(2).equal(repeat(1, 2))); }
Comment #2 by john.loughran.colvin — 2014-07-17T14:06:10Z