[Issue 20597] New: [REG2.080] Wrong closure GC allocation with dip1000

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 22 22:37:48 UTC 2020


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 at puremagic.com
          Reporter: johanengelen at 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

--


More information about the Digitalmars-d-bugs mailing list