unexpected noreturn behavior

WebFreak001 d.forum at webfreak.org
Thu Apr 21 12:41:08 UTC 2022


On Thursday, 21 April 2022 at 12:28:37 UTC, rikki cattermole 
wrote:
> noreturn is the bottom type which can implicitly convert to any 
> type, including void. A value of type noreturn will never be 
> produced and the compiler can optimize such code accordingly.
>
> https://dlang.org/spec/type.html#noreturn

ok so I guess all the `isSomething(T)` functions must be written 
like this then:

```d
enum isSomething(T) = !is(immutable T == immutable noreturn)
     && is(T : Something!Other, Other...);
```

which I think is a little bug-prone, but at least that would 
solve my issues.


More information about the Digitalmars-d-learn mailing list