On 8/21/22 21:39, Andrey Zherikov wrote:

>          alias type = typeof(U().func!0);
>          pragma(msg, type);          // pure nothrow @nogc ref @safe U()
> return

This is where the @property keyword makes a difference:

    @property auto ref func(int i)() { return this; }

Now U().func!0 will be a call in your expression. But @property is not recommended (deprecated?).

But I think std.traits.ReturnType is more explicit and does work in this case:

        import std.traits;
        alias type = ReturnType!(U().func!0);

Ali

Reply via email to