www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19962] New: [DIP1000] scope on delegate no affect with DIP1000


          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 puremagic.com
          Reporter: doob 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)

Jun 14 2019