[Issue 21003] Lambda/delegate as default value for member function argument "cannot be struct members"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 1 16:35:08 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21003

--- Comment #1 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
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

--


More information about the Digitalmars-d-bugs mailing list