DIP33: A standard exception hierarchy - finally blocks not executed for Errors

Jesse Phillips Jessekphillips+d at gmail.com
Tue Apr 2 07:18:12 PDT 2013


On Tuesday, 2 April 2013 at 12:18:00 UTC, Andrej Mitrovic wrote:
> On 4/1/13, Walter Bright <newshound2 at digitalmars.com> wrote:
>> On 4/1/2013 4:08 AM, Lars T. Kyllingstad wrote:
>>> It's time to clean up this mess.
>>
>>
>> As for why finally blocks are not executed for Error exceptions
>
> They seem to be executed:
>
> void main()
> {
>     try
>     {
>         throw new Error("");
>     }
>     finally
>     {
>         assert(0);
>     }
> }
>
> This will throw an AssertError.

The spec makes no such guarantee, DMD just doesn't bother to not 
execute it. It is one of the many things which will break code 
when DMD decides to follow the spec.


More information about the Digitalmars-d mailing list