nothrow and std.exception.ifThrown
novice2
sorryno at em.ail
Thu Apr 29 20:00:23 UTC 2021
Thank you Imperatron, Ali
both variants
```d
scope(failure) assert(0);
```
```d
collectException
```
works!
Thank Meta
> The reason for this, apparently, is in the definition of
> `ifThrown`
i tried to modify ifThrown adding nothrow,
but compiler dont understand, that second parameter cant throw,
it just expression.
i dont understand why (templates too dificult for me yet),
but if i comment "lazy" from T2,
then compiler allow add "nothrow" to "ifThrown"
```d
CommonType!(T1, T2) ifThrown(E : Throwable = Exception, T1,
T2)(lazy scope T1 expression, /*lazy*/ scope T2 errorHandler)
nothrow
```
https://run.dlang.io/is/KTdd3G
More information about the Digitalmars-d-learn
mailing list