← Back to index
|
Original Bugzilla link
Bug 22324 – Destructor not called on an array of structs
Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-20T07:09:18Z
Last change time
2024-12-13T19:18:35Z
Assigned to
No Owner
Creator
Georgy Markov
Moved to GitHub: dmd#19987 →
Comments
Comment #0
by ogion.art — 2021-09-20T07:09:18Z
Code: struct S { import core.stdc.stdio; int data; this(int data) { this.data = data; printf("ctor\n"); } ~this() { printf("dtor\n"); } } S[1] f(int x) { return [S(x)]; } void main() { auto equals = f(42) == [S(42)]; } Output: ctor ctor The problem is present in DMD since 0.63 (0.62 isn’t correct either, calling destructor 3 times for 2 constructor calls). LDC is also affected.
Comment #1
by robert.schadek — 2024-12-13T19:18:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19987
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB