```
unittest
{
import std.algorithm.comparison : equal;
import std.internal.test.dummyrange : AllDummyRanges;
import std.meta : AliasSeq, Filter;
static foreach (Range; Filter!(isForwardRange, AliasSeq!AllDummyRanges))
{{
Range r;
assert(r.take(6).takeExactly.equal!equal(
[[1, 2, 3, 4]]
));
}}
}
```
Errors:
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)0, cast(Length)0, cast(RangeType)1, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)0, cast(Length)0, cast(RangeType)2, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(DummyRange!(cast(ReturnBy)0, cast(Length)0, cast(RangeType)3, uint[])), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)1, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)2, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)1, cast(Length)0, cast(RangeType)1, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)1, cast(Length)0, cast(RangeType)2, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(DummyRange!(cast(ReturnBy)1, cast(Length)0, cast(RangeType)3, uint[])), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)1, cast(Length)1, cast(RangeType)1, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2446): Error: template std.range.takeExactly cannot deduce function from argument types !()(Take!(DummyRange!(cast(ReturnBy)1, cast(Length)1, cast(RangeType)2, uint[]))), candidates are:
range/package.d(2358): std.range.takeExactly(R)(R range, size_t n) if (isInputRange!R)
range/package.d(2398): Error: cannot use typeof(return) inside function _takeExactly_Result_asTake with inferred return type
range/package.d(2481): Error: template instance std.range.takeExactly!(FilterResult!(unaryFun, int[])) error instantiating
range/package.d(2398): Error: cannot use typeof(return) inside function _takeExactly_Result_asTake with inferred return type
range/package.d(2526): Error: template instance std.range.takeExactly!(DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)1, uint[])) error instantiating
range/package.d(2398): Error: cannot use typeof(return) inside function _takeExactly_Result_asTake with inferred return type
range/package.d(2526): Error: template instance std.range.takeExactly!(DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)2, uint[])) error instantiating
range/package.d(2398): Error: cannot use typeof(return) inside function _takeExactly_Result_asTake with inferred return type
Comment #1 by greensunny12 — 2017-12-17T03:40:51Z
Sorry just for posterity, the code sample should be:
```
import std.algorithm.comparison : equal;
import std.internal.test.dummyrange;
alias Range = DummyRange!(ReturnBy.Reference, Length.No, RangeType.Forward);
Range r;
assert(r.take(6).takeExactly(2).equal([1, 2]));
```
with the following error message:
range/package.d(2399): Error: cannot implicitly convert expression this._input of type Take!(DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)1, uint[])) to DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)1, uint[])
range/package.d(2564): Error: template instance std.range.takeExactly!(Take!(DummyRange!(cast(ReturnBy)0, cast(Length)1, cast(RangeType)1, uint[]))) error instantiating
Comment #2 by github-bugzilla — 2017-12-18T08:14:41Z