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:
irritate 2013-06-18 20:53:12 -04:00
parent 23d15e2fcb
commit ebe93db8c1
2 changed files with 18 additions and 3 deletions

View file

@ -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]));)