June 24, 2016 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 --- Comment #8 from Sobirari Muhomori <dfj1esp02@sneakemail.com> --- (In reply to David Nadlinger from comment #5) > I'm not sure how to reconcile the number of ctor/postblit calls with the number of dtor calls, though. ctor+postblit=dtor indeed, the original test case correctly tracks dtors by printing value assigned to the x field. -- |
July 11, 2016 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei@erdani.com Severity|major |critical -- |
May 12, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com Severity|critical |enhancement --- Comment #9 from Walter Bright <bugzilla@digitalmars.com> --- (In reply to Max Samukha from comment #7) > Should be either two destructors or no postblit. For "Elem arr" instead of "Elem[1] arr", only the destructor is correctly called once. What's happening here is that arrays are constructed by calling _d_arraysetctor(). That works by passing it an instance of the object Elem being constructed, which is the Elem.init object, and then copying it into arr[1]. The copy operation invokes the postblit. The code doing the postblit is here: https://github.com/dlang/druntime/blob/master/src/rt/arrayassign.d#L245 Then when it goes out of scope, the destructor is called. That's why you see a single postblit and a single destructor. The code is not incorrect, this is not a bug. However, it can be improved to skip the postblit for default initialization. Therefore, I'm going to re-categorize this as an enhancement request. -- |
May 12, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 David Nadlinger <code@klickverbot.at> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |critical --- Comment #10 from David Nadlinger <code@klickverbot.at> --- Could you please comment on the other test cases as well? I'm not convinced that they are equivalent (i.e. equivalently valid behaviour). -- |
May 12, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 --- Comment #11 from Walter Bright <bugzilla@digitalmars.com> --- Another effect you are seeing is default construction, which should account for more destructors and postblits than constructor calls. -- |
May 12, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |enhancement --- Comment #12 from Walter Bright <bugzilla@digitalmars.com> --- https://github.com/dlang/dmd/pull/6774 David, if you feel there are further issues here, please file a separate issue with a minimal example. -- |
May 12, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 --- Comment #13 from Eyal <eyal@weka.io> --- The dmd output was correct (ignoring irrelevant POSTBLIT -1) - w.r.t number of ctors/postblits & dtors. The ldc output is now correct in version: LDC - the LLVM D compiler (1.1.0git-3139c87): based on DMD v2.071.2 and LLVM 3.8.0 built with LDC - the LLVM D compiler (31eb0f) So the bug can be closed as fixed afaic. -- |
May 12, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 --- Comment #14 from Walter Bright <bugzilla@digitalmars.com> --- (In reply to Eyal from comment #13) > So the bug can be closed as fixed afaic. Thanks! But I still think you'll like the PR I made for this, as it improves performance. -- |
May 22, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 --- Comment #15 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/10c4f4acb524940cf5747bf6406dd51a13e7fbd2 fix Issue 16197 - Constructors/postblits and destructors don't match up for array initialisation https://github.com/dlang/dmd/commit/ca5a785e5ebe56a1019189801002ea214362a1f6 Merge pull request #6774 from WalterBright/fix16197 fix Issue 16197 - Constructors/postblits and destructors don't match … merged-on-behalf-of: Daniel Murphy <yebblies@gmail.com> -- |
May 22, 2017 [Issue 16197] Constructors/postblits and destructors don't match up for array initialisation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16197 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
Copyright © 1999-2021 by the D Language Foundation