Type Inference Bug?

Meta via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 21 04:20:37 PST 2014


On Friday, 21 November 2014 at 07:40:31 UTC, Daniel Murphy wrote:
> It doesn't print anything for me.  This code seems to have the 
> desired effect:
>
> shared const int i;
>
> void main()
> {
>    static if (is(typeof(i) : shared(U), U))
>    {
>         //Prints "const(int)"
>         pragma(msg, U);
>    }
> }

Hmm, do you know why is(typeof(i) == shared(U), U)) might fail? I 
wonder why : is required over ==... Doesn't the former check if T 
is a subtype of U, rather than check that they're the same type?


More information about the Digitalmars-d mailing list