https://issues.dlang.org/show_bug.cgi?id=17800
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from [email protected] --- The closure allocation error is not a bug in the `static foreach` implementation. Reduced test case: --- struct S{ enum N=1; } void foo(S v) @nogc{ enum x=()=>v.N; } --- Workaround: --- int foo(S v)@nogc{ enum x=typeof(v).N; } --- The second case is due to an oversight on my side. It can be worked around using an alias: struct S{ enum N = 1; } S foo(S v)@nogc{ alias R=typeof(return); static foreach(_;0..R.N){ } return S.init; } --
