[Issue 15246] New: Destructor inheritance doesn't inherit attributes properly

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 25 06:47:57 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15246

          Issue ID: 15246
           Summary: Destructor inheritance doesn't inherit attributes
                    properly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Consider:

void* g;

class Widget {
    ~this() {
        import std.stdio;
        writeln("Calling Widget's destructor");
        g = cast(void*) this;
        throw new Exception("");
    }
}

class Gadget : Widget {
    pure @safe @nogc nothrow ~this() {}
}

void main() {
    auto w = new Gadget;
}

This code compiles and allows "pure @safe @nogc nothrow" code to call into code
that's neither.

--


More information about the Digitalmars-d-bugs mailing list