www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15246] New: Destructor inheritance doesn't inherit attributes

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 puremagic.com
          Reporter: andrei 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.

--
Oct 25 2015