Why static analysis is the way to go

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat May 30 03:06:03 UTC 2026


On 30/05/2026 6:05 AM, Walter Bright wrote:
>     We keep finding problems with them, nothrow in particular had a bug
>     report within the last couple of months that we have yet to find a
>     solution for.
> 
> That bug report is not about nothrow.

And yet:

"Alternative to #23126 / #23127 which doesn't break nothrow inference or 
add more flags to FuncDeclaration. @adamdruppe

nothrow is special because it is computed at the end of a function with 
funcdecl.fbody.blockExit(funcdecl, ...). But before that, the catch 
block deletion is performed which also uses blockExit(func). The func 
parameter is used to infer/check nothrow for func, which allows 
recursive calls, which causes the bug: Allowing recursive calls is only 
sound when checking the entire body, not a subset of it. In the bug 
report, the throw is indeed outside the scope of the try-catch 
statement. This PR's solution is to not pass func to blockExit when used 
on only the try statement." - Dennis

Merged fix: https://github.com/dlang/dmd/pull/23194



More information about the Digitalmars-d mailing list