www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20597] New: [REG2.080] Wrong closure GC allocation with dip1000

https://issues.dlang.org/show_bug.cgi?id=20597

          Issue ID: 20597
           Summary: [REG2.080] Wrong closure GC allocation with dip1000
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

The following code used to compile with -dip1000 but no longer does since
DMD2.080:

```
 nogc void g(T)(scope T args) {}

 nogc void foo(T)(scope T args) {
    scope dg = () { g(args); };
}

void main() {
    foo("hoi");
}
```

dmd -dip1000 onlineapp.d:
onlineapp.d(3): Error: function `onlineapp.foo!string.foo` is ` nogc` yet
allocates closures with the GC
onlineapp.d(4):        onlineapp.foo!string.foo.__lambda2 closes over variable
args at onlineapp.d(3)
onlineapp.d(8): Error: template instance `onlineapp.foo!string` error
instantiating

--
Feb 22