[Issue 19962] New: [DIP1000] scope on delegate no affect with DIP1000

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 14 09:35:43 UTC 2019


          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: nobody at puremagic.com
          Reporter: doob at me.com

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

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)


More information about the Digitalmars-d-bugs mailing list