https://issues.dlang.org/show_bug.cgi?id=12808
Stanislav Blinov <stanislav.bli...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stanislav.bli...@gmail.com --- Comment #1 from Stanislav Blinov <stanislav.bli...@gmail.com> --- Rewritten relevant parts into contemprary D. With dmd 2.098: void program2() @nogc { foreach (x; [1, 2]) {} } import std.array : staticArray; void program3() @nogc { import std.algorithm: filter; foreach (x; [1, 2].filter!(x => true)) {} // fails to infer @nogc // workaround: foreach (x; [1, 2].staticArray[].filter!(x => true)) {} } int[] program5() @nogc { return [1, 2].staticArray; // detects the escape correctly } void main() {} So I guess the only outstanding enhancement here is to make this infer @nogc: foreach (x; [1, 2].filter!(x => true)) {} ...if at all possible. If not, I guess this could be closed? --