[Issue 16043] New: Wrong line number for closure in -vgc

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 18 07:37:22 PDT 2016


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

          Issue ID: 16043
           Summary: Wrong line number for closure in -vgc
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: mathias.lang at sociomantic.com

The following code:

```
void test () // L1
{
    string[] foo;
    auto f = () { assert(foo[0] == "HellO"); }; // L4
    foo ~= "HellO"; // L5
}
```

Compiled with `dmd -c -vgc test.d` gives the following output:

```
test.d(5): vgc: operator ~= may cause GC allocation
test.d(1): vgc: using closure causes GC allocation
```

So the appending has the right line, but not the closure allocation.

--


More information about the Digitalmars-d-bugs mailing list