[Issue 3516] Destructor not called on temporaries

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 10 06:11:14 PDT 2010


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


Adrian Matoga <epi at atari8.info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |epi at atari8.info


--- Comment #5 from Adrian Matoga <epi at atari8.info> 2010-07-10 06:11:10 PDT ---
Still active in 2.047,

testcase:

import std.stdio;
struct A
{
    int a;
    this(int a) { this.a = a; writeln("hello, ", a); }
    ~this() { writeln("bye, ", a); }
    void doSth() { writeln("something"); }
}
void main()
{
    auto a1 = A(1);
    a1.doSth();
    A(2).doSth();
}

produces:

hello, 1
something
hello, 2
something
bye, 1

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