struct constructors and destructors.

Danni Coy via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 19 00:48:28 PDT 2017


Is there a reason that the following code

struct Foo
{
    this (string name)
    { do_something(name); }

    ~this()
    { undo_something(); }
}

Foo foo = void;

void open()
{
    foo = Foo("test"); // <- this line
}

tries to OpAssign foo to itself then calls foo's destructor?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170719/c6b0ec17/attachment.html>


More information about the Digitalmars-d mailing list