[Issue 10928] New: Fails to create closures that reference structs with dtor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 30 07:58:44 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10928

           Summary: Fails to create closures that reference structs with
                    dtor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dmitry.olsh at gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-08-30 07:58:43 PDT ---
To make example real simple:

struct D{
    int x;
    ~this()
    {

    }
}

void foo(D bar)
{
    (){ bar.x++; }();
}

void main()
{
    foo(D.init);
}

Note that even though there is no need for allocating closure at all.
Compiler should deal with such cases by tiying the lifetime of dtor-able
variables to that of a closure if one is indeed required.

This is critical as std.array.array and other functions started using internal
lambdas for trusted blocks making use of any RefCounted range impossible.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list