www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16043] New: Wrong line number for closure in -vgc


          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 puremagic.com
          Reporter: mathias.lang 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.

May 18 2016