Bug 8253 – CTFE ICE: calling of member function of non-CTFE class variable

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-16T13:27:00Z
Last change time
2015-06-09T05:10:44Z
Keywords
CTFE, ice
Assigned to
nobody
Creator
ellery-newcomer
Depends on
7988

Comments

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
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/339ff2a11b95a42b31e0d11ba17ea970c8cb391b Fix issue 8253 ICE: calling of member function of non-CTFE class variable Test case only, already fixed by doing constfolding in CTFE. https://github.com/D-Programming-Language/dmd/commit/a0ba3b2aa31d93709a1ed3e21f5a2deca6c761fc Merge pull request #2339 from donc/fourCTFEtestcases Test cases for bugs 1982, 7988, 8253, and 8285.