RFC: Change what assert does on error

Dennis dkorpel at gmail.com
Sun Jul 6 15:48:30 UTC 2025


On Sunday, 6 July 2025 at 14:04:46 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> And then there is contracts that apparently need to catch 
> AssertError.

That's an anomaly that should be solved on its own. It doesn't 
work with -checkaction=C, and there's a preview switch for new 
behavior requiring you to explicitly create in contracts that are 
more lenient than the parent: 
https://dlang.org/changelog/2.095.0.html#inclusive-incontracts

Perhaps we can open a new thread if there's more to discuss about 
that, since this thread is already quite big and discussing 
multiple things at the same time isn't making it easier to follow 
;-)

> Why would it effect inference?
>
> Leave the frontend alone.
> 
> Do this in the glue layer. If flag is set and compiler flag is 
> set to a specific value don't add unwinding.

The frontend produces a different AST based on nothrow. Without 
any changes, field destructors are still skipped when an error 
bubbles through a constructor that inferred nothrow based on the 
assumption that range errors / assert errors are nothrow.


More information about the Digitalmars-d mailing list