https://issues.dlang.org/show_bug.cgi?id=19962
Issue ID: 19962
Summary: [DIP1000] scope on delegate no affect with DIP1000
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
The following code snippet compiles successfully WITHOUT DIP1000 enabled:
void main(string[] args) @safe @nogc
{
scope f = () {
auto a = args;
};
}
But compiling the same code WITH DIP100 enabled, the following compile error
occurs:
main.d(1): Error: function `D main` is @nogc yet allocates closures with the GC
main.d(3): main.main.__lambda2 closes over variable args at main.d(1)
--