Where should the destruction of aggregate members take place?
Henning Pohl
henning at still-hidden.de
Fri May 10 08:40:46 PDT 2013
a) In the so-called "whole dtor" which calls the dtors of all
members including the dtor declared (if any). The attributes of
the "whole dtor" are deduced.
b) Everything takes place in the dtor declared (if any). If the
dtor is pure/nothrow/safe, it is guaranteed that the object can
be destructed purely/without throwing/safely. This will break
existing code.
-----
struct S { ~this() { } }
struct SX { S s; pure ~this() { } }
-----
a) Compiles.
b) Error: S.s.~this is impure
Both behaviors are available on github:
a) https://github.com/D-Programming-Language/dmd/pull/2006
b) https://github.com/D-Programming-Language/dmd/pull/2003
You can apply this to postblit, too.
More information about the Digitalmars-d
mailing list