Checking if a type is void

Stefan Koch uplink.coder at googlemail.com
Sat May 28 14:37:42 UTC 2022


On Saturday, 28 May 2022 at 14:35:03 UTC, Stefan Koch wrote:
> On Saturday, 28 May 2022 at 14:25:57 UTC, Paul Backus wrote:
>>
>> ```d
>> alias T = int*;
>> alias U = typeof(*T);
>> static assert(is(U == int));
>> ```
>
> At first I didn't see what was unexpected about that. :)
> But yes that seems to have a similar cause.

Yes indeed!
If you try
```d
alias T = void*;
alias U = typeof(*T);
static assert(is(U == void));
```

You will the the compiler complaining about void having no value,
which indicates that the initValue is indeed the mechanism of 
operation here.


More information about the Digitalmars-d mailing list