D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23129 - object.destroy doesn't consider initialize=false on D classes
Summary: object.destroy doesn't consider initialize=false on D classes
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2022-05-20 14:37 UTC by Dennis
Modified: 2022-05-20 15:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dennis 2022-05-20 14:37:20 UTC
```
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 Dlang Bot 2022-05-20 14:48:28 UTC
@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 Dlang Bot 2022-05-20 15:29:02 UTC
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