[Issue 11826] An Access Violation in Phobos with cartesianProduct at compile-time

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Aug 9 09:25:31 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=11826

--- Comment #1 from hsteoh at quickfur.ath.cx ---
This appears to be a bug in std.algorithm.map: here's a minimal test case
reduced from the implementation of cartesianProduct:

------
import std.stdio: writeln;
import std.algorithm;

auto f(R1)(R1 range1)
{
    return [1].map!(a => range1);
}

auto r = f([1, 2, 3]);

void main() {
    r.writeln;
}
------

Moving r inside main() fixes the problem.

--


More information about the Digitalmars-d-bugs mailing list