Introduce a cast as a workaround for missing inout constructors.

This commit is contained in:
Andrej Mitrovic 2014-02-17 11:10:14 +01:00
parent 8892490584
commit 025c133e34

View file

@ -4421,7 +4421,8 @@ nothrow:
inout(typeof(this)) opSlice(size_t i, DollarToken) inout
{
return Cycle(*cast(R*)_ptr, _index + i);
// cast: Issue 12177 workaround
return cast(typeof(return))Cycle(*cast(R*)_ptr, _index + i);
}
}
@ -4587,6 +4588,11 @@ unittest //10845
assert(equal(cycle(a).take(10), [0, 1, 2, 0, 1, 2, 0, 1, 2, 0]));
}
unittest // 12177
{
auto a = recurrence!q{a[n - 1] ~ a[n - 2]}("1", "0");
}
private alias lengthType(R) = typeof(R.init.length.init);
/**