Checking if a type is void

Nick Treleaven nick at geany.org
Sun May 29 13:26:55 UTC 2022


On Saturday, 28 May 2022 at 14:37:42 UTC, Stefan Koch wrote:
> static assert(is(U == void));

I'm going to go off on a tangent just to vent:
Seeing `typeof(x) == void` doesn't even mean x is a (runtime) 
expression, because x can be a template:

template t {}
static assert(is(typeof(t) == void));

This was only recently documented in February. Apparently Walter 
and Andrei had previously said it should be removed:
https://issues.dlang.org/show_bug.cgi?id=15437#c6
https://github.com/dlang/dlang.org/pull/3218

I don't think it makes any sense.


More information about the Digitalmars-d mailing list