On Thursday, 24 April 2014 at 13:35:39 UTC, bearophile wrote:
    immutable int x = 3;
    auto result = data[].map!(y => y * x);
}


test.d(1,6): Error: function D main @nogc function allocates a closure with the GC

Such kind of code is common, so a good amount of range-based code can't be @nogc.

Why can't this be on the stack if the referenced local function (lambda) does not outlive the stack frame?

Reply via email to