[Issue 17869] scope class object no longer deleted when created via factory function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 5 17:50:02 UTC 2017


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

--- Comment #2 from Rainer Schuetze <r.sagitario at gmx.de> ---
scope class references are not supposed to be safe so far. The current spec
explicitly says the destructor is called: "This means that the destructor for
an object is automatically called when the reference to it goes out of scope.
The destructor is called even if the scope is exited via a thrown exception,
thus scope is used to guarantee cleanup."

That might not be consistent with scope as it is used by DIP1000, but changing
its meaning should at least have some notification in the changelog. IMO
-dip1000 should prohibit unsafe usage, though.

See also discussion in
https://github.com/ldc-developers/ldc/pull/2252#issuecomment-333360596

--


More information about the Digitalmars-d-bugs mailing list