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

--- Comment #7 from Pieter Penninckx <pieter.pennin...@scarlet.be> ---
The following code still segfaults with DMD 2.072.1-0.

class X 
{
    double a, b, c, d, e, f, g, h;
    X sibling;
    bool fun() const { return true;    }
    invariant() {
        if(sibling !is null) {
            if (sibling.fun())
            { assert(true);    }
        }
    }
    this() {sibling = new X(this); }
    this(X sibling_) {sibling = sibling_;}
    ~this() {}
}

int main() {
    X x = new X();
    return 0;
}


Garbage collector + destructor (or finalizer) is a difficult combination. See
for instance this comment
(https://github.com/WebAssembly/design/issues/238#issuecomment-116877193) that
strongly opposes introducing a destructor in Javascript because this
combination can lead to object resurrection (objects made reachable again in a
destructor call).

--

Reply via email to