May 03, 2019 [Issue 19843] New: Derived class has `__dtor` member if base class implements `~this()` | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19843 Issue ID: 19843 Summary: Derived class has `__dtor` member if base class implements `~this()` Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: slavo5150@yahoo.com class B { ~this() {} } class C : B { // NOTICE: No destructor } void main() { static assert(__traits(hasMember, B, "__dtor")); static assert(!__traits(hasMember, C, "__dtor"), "C should not have a `__dtor` member"); static assert(__traits(hasMember, B, "__xdtor")); static assert(__traits(hasMember, C, "__xdtor")); } Since `C` does not have an implementation for `~this()` it should not have a `__dtor` member. Both `B` and `C` should have an `__xdtor` member, though. (At least that is my understanding) -- |
Copyright © 1999-2021 by the D Language Foundation