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

Now how about this one:

alias Unshared(T: shared U, U) = U;
pragma(msg, Unshared!(shared const int)); //Prints const(int)

Does the `:` denote subtyping as well, or equality? I'm sure that

Neither.  IIRC it's something close to type implicit conversion rules.

alias A(T : long) = T;
pragma(msg, A!int);

in this case it's the latter, which makes me more strongly suspect that
`is(T == shared U, U)` not working is a bug.

Probably. It looks like that matches only shared(U) and not const(shared(U)), so it could be intentional that it means exactly shared. I would guess it's an oversight.

Furthermore, I'm starting to get very confused:

enum sameTypes(T, U) = is(T: U) && is(U: T);

assert(sameTypes!(const int, immutable int)); //Ok, wtf?
assert(sameTypes!(int, immutable int); //Ok, wtf?

All of those types implicitly convert to each other.

Reply via email to