D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19962 - [DIP1000] scope on delegate no affect with DIP1000
Summary: [DIP1000] scope on delegate no affect with DIP1000
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: safe
Depends on:
Blocks:
 
Reported: 2019-06-14 09:35 UTC by Jacob Carlborg
Modified: 2021-01-13 21:34 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jacob Carlborg 2019-06-14 09:35:43 UTC
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)
Comment 1 Bolpat 2021-01-13 21:34:51 UTC
Has been fixed in 2.092.1.