On Friday, 10 August 2018 at 07:19:02 UTC, Andrea Fontana wrote:
On Friday, 10 August 2018 at 07:01:09 UTC, Petar Kirov [ZombineDev] wrote:

`is(T == U)` evaluates to true iff `T` is exactly `U`. `is(T : U)` tests if `T` is a subtype of (can be implicitly converted to) `U` [0]. So we have:

`is(typeof(assert(0)) == T)` is false, unless `T` is `typeof(assert(0))` `is(typeof(assert(0)) : T)` is always true (as bottom is implicitly convertible to any other type, including itself).

[0]: https://dlang.org/spec/expression#is_expression

So if I need to write something like:

void callback(alias T)() if(is(ReturnType!T ==  int))

I have to change it to:
void callback(alias T)() if(is(ReturnType!T == int) || is(ReturnType!T == typeof(assert(0)))


No. That's the point - you don't have to change anything.

Reply via email to