Thread overview
[Issue 24460] scope(failure) with a goto breaks safety
Mar 28
RazvanN
Mar 28
RazvanN
Jul 23
Bolpat
March 28
https://issues.dlang.org/show_bug.cgi?id=24460

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
This doesn't seem like a safety violation. Rather that the scope failure should not catch the assert error.

--
March 28
https://issues.dlang.org/show_bug.cgi?id=24460

--- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> ---
Scratch that. The problem is that you are not rethrowing the exception/error if you use a goto.

--
March 28
https://issues.dlang.org/show_bug.cgi?id=24460

elpenguino+D@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=24462

--
March 28
https://issues.dlang.org/show_bug.cgi?id=24460

elpenguino+D@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=24463

--
July 23
https://issues.dlang.org/show_bug.cgi?id=24460

Bolpat <qs.il.paperinik@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qs.il.paperinik@gmail.com

--- Comment #3 from Bolpat <qs.il.paperinik@gmail.com> ---
It seems `scope(failure) Fix; After;` lowers to
```d
try
{
    After;
}
catch(Throwable __o40)
{
    Fix;
    throw;
}
```

But it should lower to:
```d
try
{
    After;
}
catch(Throwable __th)
{
    scope(exit) throw __th;
    Fix;
}
```

`scope(failure)` is not supposed to be able to swallow the thrown object.

--