November 01, 2014 [Issue 13669] New: [CTFE] Destructor call on static array variable is not yet supported in CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13669 Issue ID: 13669 Summary: [CTFE] Destructor call on static array variable is not yet supported in CTFE Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: CTFE Severity: major Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: k.hara.pg@gmail.com 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()) -- |
Copyright © 1999-2021 by the D Language Foundation