On Monday, 22 August 2022 at 05:25:50 UTC, Ali Çehreli wrote:
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.
Is original `U().func!0` not a call?
But I think std.traits.ReturnType is more explicit and does
work in this case:
import std.traits;
alias type = ReturnType!(U().func!0);
This works but looks strange - I'm checking the type of UDA
expression:
```d
@(U().func!0) int b;
pragma(msg, __traits(getAttributes, b)); //
tuple(U().func)
pragma(msg, typeof(__traits(getAttributes, b)[0])); // pure
nothrow @nogc ref @safe U() return
pragma(msg, ReturnType!(__traits(getAttributes, b)[0])); // U
pragma(msg, is(typeof(__traits(getAttributes, b)[0]) : U)); //
false
pragma(msg, hasUDA!(b, U)); // false
```