"Meta"  wrote in message news:wzczhiwokauvkkevt...@forum.dlang.org...

shared const int i;

static if (is(typeof(i) T == shared U, U))
{
     //Prints "shared(const(int))"
     pragma(msg, U);
}

This seems like subtly wrong behaviour to me. If T == shared U, for some U, then shouldn't U be unshared? If T is shared(const(int)), and T is the same as the type U with the 'shared' qualifier applied to it, then U should be of type const(int), not shared(const(int)).

I'm bringing this up partially because it seems wrong to me, and partially because we currently don't have a good why of "shaving" the outermost qualifier off a type, and this seemed the natural way to do it to me (I was surprised when it didn't work).

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);
   }
}

Reply via email to