On Thursday, 5 July 2018 at 10:32:01 UTC, Timoses wrote:
    int fun(T)(T i)
    {
        static assert(is(typeof(return) == T)); //true
        pragma(msg, is(T == return)); // false
        static if (is(T ReturnType == return))
            pragma(msg, ReturnType); // does not enter
        return i;
    }
    unittest
    {
        fun(3);
    }

What's the purpose of 'is(T == return)' if not the above?

I always thought that "return" is a keyword.

https://dlang.org/spec/lex.html#keywords

And the fact, that you can ask the keyword about its type is just a nice feature... ;)

Reply via email to