www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21003] New: Lambda/delegate as default value for member


          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 puremagic.com
          Reporter: stanislav.blinov gmail.com

struct S
    void foo(int value)
        bar(() => value);

    void bar(Dg)(Dg dg = () => 0)
        import std.stdio;

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

Jul 01 2020