mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
Issue 10130 - Fix compile error when calling map on iota with const step.
Also fixed the similar issue for iota with const begin/end/step floats.
This commit is contained in:
parent
23d15e2fcb
commit
ebe93db8c1
2 changed files with 18 additions and 3 deletions
|
@ -599,6 +599,20 @@ unittest
|
|||
assert(equal(m, [1L, 4L, 9L]));
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
// Issue #10130 - map of iota with const step.
|
||||
const step = 2;
|
||||
static assert(__traits(compiles, mixin("map!(i => i)(iota(0, 10, step))")));
|
||||
|
||||
// Need these to all by const to repro the float case, due to the
|
||||
// CommonType template used in the float specialization of iota.
|
||||
const floatBegin = 0.0;
|
||||
const floatEnd = 1.0;
|
||||
const floatStep = 0.02;
|
||||
static assert(__traits(compiles, mixin("map!(i => i)(iota(floatBegin, floatEnd, floatStep))")));
|
||||
}
|
||||
|
||||
/**
|
||||
$(D auto reduce(Args...)(Args args)
|
||||
if (Args.length > 0 && Args.length <= 2 && isIterable!(Args[$ - 1]));)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue