AliasSeq + isExpression type specialization behavior

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 10 08:39:15 PST 2015


On Monday, 9 November 2015 at 22:41:50 UTC, Brian Schott wrote:
> Given the following code:
> ```
> import std.meta;
>
> static assert(is(char : dchar));
> static assert(is(AliasSeq!(int, char) : AliasSeq!(int, char)));
> static assert(is(AliasSeq!(int, char) : AliasSeq!(int, dchar)));
> ```
>
> The third static assert fails. Should it, given that the first 
> and second pass?

`:` in `is` is for testing whether the left type is implicitly 
convertible to the right type. `char` is implicitly convertible 
to `dchar` by promoting it. But `AliasSeq`s are collections; 
they're only implicitly convertible to themselves.


More information about the Digitalmars-d-learn mailing list