Calling template member function?

Andrey Zherikov andrey.zherikov at gmail.com
Tue Apr 19 18:20:37 UTC 2022


On Tuesday, 19 April 2022 at 18:18:26 UTC, Andrey Zherikov wrote:
> Is there a way/workaround to achieve the desired behavior? 
> Those two bugs pointed above were reported in 2017 and 2011 (!) 
> which makes me think that they won't be fixed any time soon 
> (I'm not sure that they are actually the same issue as I faced 
> here).

I tried to change the code to this:
```d
void f(FUNC)(FUNC func)
{
     enum dg = () => func();
     T!int.f_new!dg;
}
```

But I get this error:
```
onlineapp.d(7): Error: delegate `onlineapp.f!(void function() 
@safe).f.__lambda2` is a nested function and cannot be accessed 
from `onlineapp.T!int.f_new!(delegate () @safe
{
(*func)();
return ;
}
).f_new`
```


More information about the Digitalmars-d-learn mailing list