typeof(func!0) != typeof(func!0())
Andrey Zherikov
andrey.zherikov at gmail.com
Mon Aug 22 14:43:24 UTC 2022
But the question is still opened: why is `typeof(U().func!0)` not
the same as `typeof(U().func!0())`?
There is also inconsistency within UFCS - type depends on whether
function is a member or standalone (even if I replace `auto ref`
with `ref U`):
```d
struct U
{
ref U func(int i)() { return this; }
}
ref U func2(int i)(ref U u) { return u; }
void main()
{
U u;
pragma(msg, typeof(u.func!0)); // pure nothrow @nogc ref
@safe U() return
pragma(msg, typeof(u.func2!0)); // U
}
```
More information about the Digitalmars-d-learn
mailing list