[Issue 22680] @safe hole with destructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 17 14:36:11 UTC 2022


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

Stanislav Blinov <stanislav.blinov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanislav.blinov at gmail.com

--- Comment #4 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
(In reply to RazvanN from comment #3)

> My comment was unfinished. What I wanted to propose is to mark destructors
> that are @safe with scope. I don't think there would be any un-wanted side
> effects.
> 

There would be unwanted side effects. On a struct, for example, marking a
destructor scope would prevent you from returning instances of such struct.

I think that a more prudent measure is to mark escaping destructors @system
(i.e. making original code a compile-time error).

--


More information about the Digitalmars-d-bugs mailing list