[Issue 15247] Object's destructor should be pure @safe nothrow @nogc
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Oct 27 10:33:39 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15247
Marco Leise <Marco.Leise at gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Marco.Leise at gmx.de
--- Comment #3 from Marco Leise <Marco.Leise at gmx.de> ---
class D
{
~this() @system {}
}
void main()
{
foo(new D);
}
void foo(Object o) pure @safe nothrow @nogc
{
o.destroy(); // Whatever we call it...
}
What I'm saying here is, if destructors were virtual methods that inherit and
recursively call their base class destructors, and we had pure @safe nothrow
@nogc on Object, we could NOT actually introduce impure destructors, as the
compiler cannot statically verify attributes that may be loosened in a derived
class. Attributes can only be added to overridden methods never removed, the
same way methods can only be added and not removed. This bug report is invalid,
in my humble opinion.
--
More information about the Digitalmars-d-bugs
mailing list