[Issue 22099] scope(exit) / finally blocks not are always executed inside of a anonymous function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 10 08:05:17 UTC 2023


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|---                         |INVALID

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
The trouble here is that a RangeError is being thrown. A RangeError is an
Error, and finally blocks are not executed when unwinding an Error. The
rationale is that Errors are fatal, and may be thrown because the program has
entered an invalid state. Executing finally blocks may cause further undefined
behavior.

Changing the exception type to Exception causes the program to work as
expected, as Exceptions execute finally blocks when unwinding.

Marked as INVALID.

--


More information about the Digitalmars-d-bugs mailing list