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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 30 08:47:37 PDT 2013


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #3 from monarchdodra at gmail.com 2013-08-30 08:47:35 PDT ---
(In reply to comment #2)
> For reference, an "in-the-wild" example of such an error:
> http://forum.dlang.org/post/mailman.445.1377370120.1719.digitalmars-d@puremagic.com
> http://forum.dlang.org/thread/mailman.443.1377369357.1719.digitalmars-d@puremagic.com
> 
> This is a concern as it potentially blocks the ability to move forward with
> necessary redesign work on random number generation in Phobos.

Currently, a *workaround* is to avoid lambdas in favor of named:

//----
struct D
{
    int x;
    ~this()
    {

    }
}

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

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

-- 
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