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: [email protected]
          Reporter: [email protected]

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.

--

Reply via email to