Struct destructor in a with block

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 2 19:51:17 PST 2015


module main;
import std.stdio;
void main(string[] args)
{
	with(test())
	{
		foo();
	}
}
struct test
{
	void foo()
	{
		writeln("foo");
	}
	~this()
	{
		writeln("destoy");
	}
}

prints:
      destroy
      foo

Is this a bug?


More information about the Digitalmars-d-learn mailing list