[Issue 20506] [DIP1000] scope variable cannot be thrown

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 11 23:43:47 UTC 2021


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

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl

--- Comment #1 from Dennis <dkorpel at live.nl> ---
It's not that obvious, checking nothrow is not enough. This is not allowed:

```
void main () @safe @nogc nothrow
{
    try {
        scope exc = new Exception("Baguette");
        throw exc;
    } catch (Exception e) {
        assert(e is exc);
    }
}
```

There needs to be a check whether the try-catch block that catches the
exception is inside the scope of the variable that is being thrown.

--


More information about the Digitalmars-d-bugs mailing list