bearophile <[email protected]> wrote:

According to TDPL the whole object destructor chain is called up to the top of the hyerarchy.
This D2 program compiles and runs with DMD 2.048 with no errors:


import std.c.stdio: puts;
class Base {
     private final ~this() { puts("Base.~this"); }
}
class Derived : Base {
    private final ~this() { puts("Derived.~this"); }
}
void main() {
    new Derived();
}


Output:

Derived.~this
Base.~this


Are the 'private final' attributes used here correct?
See also:  http://d.puremagic.com/issues/show_bug.cgi?id=3934

A destructor is always final, and private destructors make no sense,
so I would say the attributes should not be there.

--
Simen

Reply via email to