Destructor order

eles via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 22 16:05:19 PDT 2014


On Wednesday, 22 October 2014 at 18:03:44 UTC, anonymous wrote:
> On Wednesday, 22 October 2014 at 15:45:02 UTC, eles wrote:
>> D version:

> `foo` should be a `Scoped!A`. When it's typed as `A`, the
> `Scoped!A` that is returned by `scoped`, is destructed
> immediately (and the reference leaks, I guess).

And the compiler swallows this without even barking? Why Scoped!A 
is convertible to A, then? And what the resulting A-typed 
variable contains if the object gets destroyed. And what use for 
that content?


More information about the Digitalmars-d-learn mailing list