https://issues.dlang.org/show_bug.cgi?id=17800
Issue ID: 17800
Summary: [2.076] "static foreach" allocates closures in GC
without reason
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
struct S
{
enum N = 1;
}
void foo(S v) @nogc
{
static foreach(_; 0 .. v.N)
{
}
}
----
Error: function mir.ndslice.slice.foo is @nogc yet allocates closures with the
GC
source\mir\ndslice\slice.d(290,23):
foo.__lambda2.__lambda1 closes over variable v
--