[code] import std.stdio; class Vec2 { public: short x, y; this(short x, short y) { this.x = x; this.y = y; } }
void foo(Vec2 v) { delete v; } void bar(Vec2 v) { } void main() { foo(new Vec2(42, 23)); Vec2 v1 = new Vec2(4, 2); foo(v1); assert(v1 !is null); writefln("v1.x = %d", v1.x); Vec2 v2 = new Vec2(4, 2); bar(v2); writefln("v2.x = %d", v2.x); } [/code] This code prints: v1.x = 0 v2.x = 4 But is this correct? I expected v1.x = 4 v2.x = 4 Same behaviour with destroy.