February 05, 2005
I know it was brought up a while back, but I wanted to check with the group and make sure that it's still the case.

D's destructors are not to be called from within other destructors, correct? (or more succinctly: do not use 'delete' in a dtor)

I just ran into an issue where I was using 'delete' down the call chain from a module dtor.  It routinely causes a fault in "__d_delclass", according to MSVC's debugger.

- EricAnderton at yahoo
February 05, 2005
"pragma" <pragma_member@pathlink.com> wrote in message news:cu1d76$rmi$1@digitaldaemon.com...
>I know it was brought up a while back, but I wanted to check with the group and
> make sure that it's still the case.
>
> D's destructors are not to be called from within other destructors,
> correct? (or
> more succinctly: do not use 'delete' in a dtor)
>
> I just ran into an issue where I was using 'delete' down the call chain
> from a
> module dtor.  It routinely causes a fault in "__d_delclass", according to
> MSVC's
> debugger.
>
> - EricAnderton at yahoo

correct. A destructor cannot assume any other GC-managed resource is alive. The order in which the memory is reclaimed in a given GC pass is undefined.