Checking if a type is void
Stefan Koch
uplink.coder at googlemail.com
Sat May 28 14:47:00 UTC 2022
On Saturday, 28 May 2022 at 14:43:13 UTC, Paul Backus wrote:
> Interestingly, there are some operators that cause the compiler
> to catch the error:
>
> ```d
> alias T = int*;
> alias U = typeof(T[0 .. 0]);
> // Error: cannot slice type `int*`
> ```
>
> So I guess this is just a case of missing checks in the
> semantic analysis of certain kinds of expressions.
It open up the question of whether it should actually be an error.
Having every time which is not `void` or `typeof(assert(0))` to
evaluate to a false boolean doesn't seem to be too bad to me.
More information about the Digitalmars-d
mailing list