Comment #0 by stanislav.blinov — 2020-07-01T15:23:37Z
struct S
{
void foo(int value)
{
bar(() => value);
}
void bar(Dg)(Dg dg = () => 0)
{
import std.stdio;
writeln(dg());
}
}
In the above, the call to `bar` inside `foo` fails to compile with:
bug.d(8): Error: delegate bug.S.bar(Dg)(Dg dg = () => 0) cannot be struct members
Comment #1 by stanislav.blinov — 2020-07-01T16:35:08Z
Further reduction, `bar` doesn't need to be a template, e.g.
struct S
{
void foo(int value)
{
bar(() => value);
}
void bar(int delegate() dg = () => 0)
{
import std.stdio;
writeln(dg());
}
}
bug.d(8): Error: delegate bug.S.__lambda3 cannot be struct members
Comment #2 by robert.schadek — 2024-12-13T19:09:50Z