typeof(func!0) != typeof(func!0())

Paul Backus snarwin at gmail.com
Mon Aug 22 12:04:09 UTC 2022


On Monday, 22 August 2022 at 11:24:59 UTC, Andrey Zherikov wrote:
> On Monday, 22 August 2022 at 06:01:11 UTC, JG wrote:
>> Why not just change to:
>> alias type = typeof(U().func!0());
>
> This is user's code and `U().func!0` is legit syntax.

Workaround: wrap it in a lambda.


```d
import std.traits;

alias type = ReturnType!(() => U().func!0);
```


More information about the Digitalmars-d-learn mailing list