Thread overview | |||||
---|---|---|---|---|---|
|
February 03, 2015 Struct destructor in a with block | ||||
---|---|---|---|---|
| ||||
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? |
February 03, 2015 Re: Struct destructor in a with block | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | 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
|
February 03, 2015 Re: Struct destructor in a with block | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Tuesday, 3 February 2015 at 05:09:55 UTC, Ali Çehreli wrote: > Yes, it's a known bug that has been fixed on git head but I can't find the bug report. :-/ Ok cool, good to know. > The new output: > > foo > destoy > > Yes, without the 'r'. ;) > > Ali Yeah, i noticed the typo right after I posted... |
Copyright © 1999-2021 by the D Language Foundation