[Issue 704] `class` destructor is called even if constructor throws

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 23 16:15:02 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=704

feklushkin.denis at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |feklushkin.denis at gmail.com

--- Comment #16 from feklushkin.denis at gmail.com ---
(I spent a few days looking for an issue caused by this mandatory call of dtor
when ctor thrown an exception.)

Why it is need to call dtor if ctor isn't sucessful finished?
For purposes of simple correct cleanup we already have scope guards - it can be
used inside of ctor.

And this behaviour should be at least described in the manual.

--


More information about the Digitalmars-d-bugs mailing list