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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 1 15:23:37 UTC 2020


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

          Issue ID: 21003
           Summary: Lambda/delegate as default value for member function
                    template argument "cannot be struct members"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: stanislav.blinov at gmail.com

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

--


More information about the Digitalmars-d-bugs mailing list