Comment #0 by ellery-newcomer — 2012-06-16T13:27:00Z
dmd 2.059
the [invalid] code:
class J {
J j2(){
return new J();
}
}
J j() {
static J m, func;
static func = m.j2();
return func;
}
the compile:
dmd test.d
the fireworks:
dmd: interpret.c:94: Expression* CtfeStack::getValue(VarDeclaration*): Assertion `v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack < globalValues.dim' failed.
Aborted (core dumped)
Comment #1 by clugdbug — 2012-09-20T23:44:34Z
Further reduced:
----------------
class Bug8253 {
bool j(){
return true;
}
}
Bug8253 m8253;
static assert(m8253.j());
----------------
Also applies to D1.
The problem is that the 'variable cannot be read at compile error' is generated by constant folding, not by CTFE. Fixing bug 7988 would fix this.
Comment #2 by clugdbug — 2012-09-20T23:45:30Z
*** Issue 8679 has been marked as a duplicate of this issue. ***
Comment #3 by github-bugzilla — 2013-07-12T14:07:14Z