Where should the destruction of aggregate members take place?

Kenji Hara k.hara.pg at gmail.com
Fri May 10 09:08:41 PDT 2013


2013/5/11 Henning Pohl <henning at 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.

Pull#2006 will change back the behavior to a), but pull#2003 doesn't.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130511/a819bd6c/attachment-0001.html>


More information about the Digitalmars-d mailing list