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

--- Comment #2 from [email protected] ---
Managed to reduce it to this near-minimal segfaulting test case:

------
struct MapResult(alias fun, Range)
{
    @property front()
    {
        return fun(0);
    }
}

auto f(R1)(R1 range1)
{
    return MapResult!(a => range1, int[])();
}

auto r = f([2]);

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

Seems to be a codegen bug; moving the declaration of r inside main() fixes the
problem. Disassembly from inside gdb shows a null pointer dereference inside
the lambda. Not sure exactly what pointer that is yet, but I suspect it's
trying to access the stack frame of f() to get at the parameter 'range1', which
has gone out of scope.

--

Reply via email to