Struct destructor in a with block
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 2 21:09:54 PST 2015
On 02/02/2015 07:51 PM, Tofu Ninja wrote:
> 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?
Yes, it's a known bug that has been fixed on git head but I can't find
the bug report. :-/
The new output:
foo
destoy
Yes, without the 'r'. ;)
Ali
More information about the Digitalmars-d-learn
mailing list