Bug 9036 – postblit is called for nested structs when assigning `init`

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-16T11:40:00Z
Last change time
2012-12-04T18:29:37Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg
Depends on
9035

Comments

Comment #0 by verylonglogin.reg — 2012-11-16T11:40:07Z
Note that we have zero context pointer in such postblit call: --- int i; struct S { this(this) { ++i; } } void main() { S s = S.init; assert(i == 0); // postblit not called s = S.init; assert(i == 0); // postblit not called int k; static int j = 0; struct N { this(this) { ++j; assert(this.tupleof[$-1] != null); // fails } void f() { ++k; } } N n = N.init; assert(j == 0); // fails, j = 1, postblit called n = N.init; assert(j == 0); // fails, j = 2, postblit called } ---
Comment #1 by k.hara.pg — 2012-11-18T20:31:14Z
This is a derived issue from the bug 9035. If it is correctly fixed, this bug will be disappeared.
Comment #2 by k.hara.pg — 2012-11-18T21:48:42Z
Comment #3 by github-bugzilla — 2012-12-03T20:58:29Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6861282d3877f504c4b9e586917d0333e8b1c5f4 fix Issue 9036 - postblit is called for nested structs when assigning `init` https://github.com/D-Programming-Language/dmd/commit/3b061322300c5b7a39f1b5c5f76016a4d9906899 Merge pull request #1301 from 9rnsr/fix9035 Issue 9035 & 9036 - Nested struct `init` is lvalue and can be modified