Thread overview
[Issue 19843] Derived class has `__dtor` member if base class implements `~this()`
May 03
Basile-z
May 03
https://issues.dlang.org/show_bug.cgi?id=19843

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
I think that this report is invalid. For classes you use the derivedMembers traits to see if a particular generation introduce new members. hasMember will work in combination with allMembers which doesn't make the difference.

--
May 03
https://issues.dlang.org/show_bug.cgi?id=19843

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Mike Franklin <slavo5150@yahoo.com> ---
Thanks Basile-z.  I think you're right.  I'll close this.

--
May 03
https://issues.dlang.org/show_bug.cgi?id=19843

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com

--- Comment #3 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
Basile-z's comment is correct. Proof:

class A {
    ~this() {}
}
class B : A {
}
class C : A {
    ~this() {}
}

// A and B's __dtor are the same:
static assert( __traits(isSame,
    __traits(getMember, A, "__dtor"),
    __traits(getMember, B, "__dtor")));

// A and C's are not:
static assert(!__traits(isSame,
    __traits(getMember, A, "__dtor"),
    __traits(getMember, C, "__dtor")));

--