As discussed in this thread ( http://forum.dlang.org/post/1566418.J7qGkEti3s@lyonel ), according to Walter, it is _not_ guaranteed that finally blocks, scope statements, and destructors will be run when an Error is thrown. However, the current implementation guarantees it in almost all circumstances (nothrow functions are one exception, I believe). As it stands, code is being written with the assumption that Errors _do_ trigger those constructs (especially with regards to AssertError). So, if the current behavior ever changes, it could break a lot of code.
There is quite a lot of dispute in that thread about what the behavior should be (guarantee cleanup or don't guarantee cleanup). We need a decision on this and to make the implementation match that and be _guaranteed_ to match it, with the spec reflecting it. Otherwise, we have undefined behavior (which D typically tries to avoid) which quite a few programs are currently relying on and which may change in the future.
Comment #1 by robert.schadek — 2024-12-15T15:21:58Z