digitalmars.D.bugs - invariant called on return from super()
- Andy Friesen (20/20) Jun 01 2004 class A {
class A {
this(int i) { _i = i; }
invariant { assert(_i != 0); }
int _i;
}
class B : A {
this(int i, int j) {
super(i);
_j = j;
}
invariant { assert(_j != 0); } // line 15
int _j;
}
int main() {
B b = new B(8, 2);
return 0;
}
Compiles fine. When run, the output is
Error: AssertError Failure test.d(15)
-- andy
Jun 01 2004








Andy Friesen <andy ikagames.com>