Bug 9245 – [CTFE] postblit not called on static array initialization

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-30T01:16:00Z
Last change time
2014-04-24T21:20:11Z
Keywords
CTFE, pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2012-12-30T01:16:52Z
--- void f() { int postblits = 0; struct S { this(this) const { ++postblits; } } auto s = S(); S[2] arr = s; assert(postblits == 2); // failed: S.postblits == 0 postblits = 0; const S[2] constArr = s; assert(postblits == 2); // failed: S.postblits == 0 postblits = 0; const S[2] constArr2 = arr; assert(postblits == 2); // failed: S.postblits == 0 postblits = 0; } --- Also see same non-CTFE issue 8950.
Comment #1 by k.hara.pg — 2014-04-23T02:09:18Z
Comment #2 by github-bugzilla — 2014-04-24T21:20:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3910d5cf1b0bed9c9ebd9b58470209b2ea6c9867 fix Issue 9245 - [CTFE] postblit not called on static array initialization On element-wise or block assignment, currently postblit call is implicitly handled by glue-layer. Therefore, interpreter should have its own postblit handling. https://github.com/D-Programming-Language/dmd/commit/6de3bd56a622c99997be55a609268d6f2dcfcb77 Merge pull request #3488 from 9rnsr/fix9245 Issue 9245 - [CTFE] postblit not called on static array initialization