Bug 13669 – [CTFE] Destructor call on static array variable is not yet supported in CTFE

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-11-01T08:08:00Z
Last change time
2015-02-18T03:39:58Z
Keywords
CTFE, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2014-11-01T08:08:08Z
Following code should work, but doesn't. bool test() { string dtor; struct S { char x = 'x'; ~this() { dtor ~= x; } } { S[2] a; } // line 12 assert(dtor == "xx"); dtor = ""; { S[2] a = [S('a'), S('b')]; } assert(dtor == "ab"); return true; } static assert(test()); Currently the case outputs weird CTFE error. test.d(12): Error: static variable typeid(S[2]) cannot be read at compile time test.d(21): called from here: test() test.d(21): while evaluating: static assert(test())
Comment #1 by k.hara.pg — 2014-11-01T08:32:20Z
Comment #2 by github-bugzilla — 2014-11-23T03:13:02Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6ee121df3eec74835b9d6e75b57af6f25bf009a9 fix Issue 13669 - [CTFE] Destructor call on static array variable is not yet supported in CTFE
Comment #3 by github-bugzilla — 2015-01-25T00:11:37Z
Comment #4 by github-bugzilla — 2015-02-18T03:39:58Z
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6ee121df3eec74835b9d6e75b57af6f25bf009a9 fix Issue 13669 - [CTFE] Destructor call on static array variable is not yet supported in CTFE https://github.com/D-Programming-Language/dmd/commit/59a5fd49d1f03be8d0ac44abf03c109880f2aefb Move issue 13669 test in runnable, and fix order of dtor calls