Why is dtor called for lazy parameter?

ikod igor.khasilev at gmail.com
Fri Sep 18 10:54:41 UTC 2020


On Friday, 18 September 2020 at 10:43:47 UTC, Andrey Zherikov 
wrote:
> I have this code:
> ==========
> class S
...

>
> auto create()
> {
>     writeln("-> ",__PRETTY_FUNCTION__);
>     scope(exit) writeln("<- ",__PRETTY_FUNCTION__);
>
>     return scoped!S(1);
> }

If you replace this line with "return new S(1)" it should work as 
you expect.



More information about the Digitalmars-d-learn mailing list