https://issues.dlang.org/show_bug.cgi?id=1164
Pieter Penninckx <pieter.penninckx at scarlet.be> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pieter.penninckx at scarlet.be
Version|D1 |2.040
--- Comment #5 from Pieter Penninckx <pieter.penninckx at scarlet.be> ---
Reproduced with DMD version 2.065.
If the destructor cannot reference sub objects, this implies that also an
invariant cannot reference sub objects, because an invariant is called just
before the destructor. Example below triggers segfault with DMD version 2.065.
class B
{
double a, b, c, d, e, f, g, h;
bool fun() const { return true; }
}
class A
{
B b;
invariant() {
assert(b !is null);
if (b.fun()) // <- Segfault here, but b is not null.
{ assert(true); }
}
this() { b = new B(); }
~this() {}
}
int main() {
A a = new A();
return 0;
}
--