digitalmars.D - Where should the destruction of aggregate members take place?
- Henning Pohl (17/17) May 10 2013 a) In the so-called "whole dtor" which calls the dtors of all
- Kenji Hara (6/22) May 10 2013 Until 2.062, dmd has been behaved as a) for destructors, but current git
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.
May 10 2013
2013/5/11 Henning Pohl <henning still-hidden.de>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<https://github.com/D-Programming-Language/dmd/pull/2006> b) https://github.com/D-**Programming-Language/dmd/pull/**2003<https://github.com/D-Programming-Language/dmd/pull/2003> You can apply this to postblit, too.Until 2.062, dmd has been behaved as a) for destructors, but current git head is accidentally changed to b). I think it is a regression. Kenji Hara
May 10 2013