[Issue 13244] Wrong code with -inline and foreach/map/all

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 2 03:32:11 PDT 2015


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

--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
Reduced case in comment #1 does not reproduce segfault with 2.068 git-head.

Another reduction is:

struct MapResult(alias fun)
{
    int[] input;
    @property front() { return fun(input[0]); }
}

int[] array(R)(R r)
{
    int[] a;
    a ~= r.front;
    return a;
}

void main()
{
    auto arr = [[cast(ubyte)1]];
    foreach (ref x; arr)
    {
        auto m = MapResult!(c => x[c])([0]);
        array(m);
    }
}

--


More information about the Digitalmars-d-bugs mailing list