import std.stdio;
struct Struct
{
this(int value) { writeln("Struct.this(", value, ")"); }
~this() { writeln("Struct.~this()"); }
}
void main()
{
Struct s = Struct(1); // prints `Struct.this(1)`
s(2); // prints `Struct.this(2)`
s(3); // prints `Struct.this(3)`
} // prints `Struct.~this()`
Notice how the destructor is only called once. If there was an opCall defined for Struct, its reconstruction would shadow it. It certainly looks like a bug to me, but since I'm "sure of nothing" in D I decided to post it here. Is it really a bug?
--
Atenciosamente / Sincerely,
Guilherme ("n2liquid") Vieira