[Issue 5657] Temporary object destruction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 19 19:32:26 PDT 2011


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #7 from Walter Bright <bugzilla at digitalmars.com> 2011-04-19 19:28:48 PDT ---
The patch fails to call the destructor with the following code:

import std.c.stdio;

struct S
{
    int x = 1;

    int bar() { return x; }

    this(int i)
    {
        printf("ctor %p(%d)\n", &this, i);
        t ~= "a";
    }

    this(this)
    {
        printf("postblit %p\n", &this);
        t ~= "b";
    }

    ~this()
    {
        printf("dtor %p\n", &this);
        t ~= "c";
    }

    static string t;
}

S bar() { return S(1); }

void main()
{
    bar().x += 1;
}

I'll see if I can come up with a solution.

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