Bug 23129 – object.destroy doesn't consider initialize=false on D classes
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-05-20T14:37:20Z
Last change time
2022-05-20T15:29:02Z
Keywords
pull
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2022-05-20T14:37:20Z
```
class C { int x; }
void main()
{
C inst = new C();
inst.x = 123;
destroy!false(inst); // don't initialize
assert(inst.x == 123); // fails, inst.x was still set to 0
}
```
Comment #1 by dlang-bot — 2022-05-20T14:48:28Z
@kinke updated dlang/druntime pull request #3821 "Don't re-initialize D class instances in destroy!false()" fixing this issue:
- Fix Issue 23129 - Don't re-initialize D class instances in destroy!false()
When it's explicitly *not* requested.
https://github.com/dlang/druntime/pull/3821
Comment #2 by dlang-bot — 2022-05-20T15:29:02Z
dlang/druntime pull request #3821 "Don't re-initialize D class instances in destroy!false()" was merged into master:
- 98d2b76a2cf6643083da96f3a0bb59c330152fa0 by Martin Kinkelin:
Fix Issue 23129 - Don't re-initialize D class instances in destroy!false()
When it's explicitly *not* requested.
https://github.com/dlang/druntime/pull/3821