www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21377] New: Unclear error message "delegate __lambda cannot


          Issue ID: 21377
           Summary: Unclear error message "delegate __lambda cannot be
                    struct members"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bradley.chatha gmail.com

The following code produces an error (possible bug?) with a very confusing and
unclear message:

struct S
    bool delegate(string) f;

 S(str => true) // VALID
int a;

S s = S(str => true); // VALID

struct S2
     S(str => false) // INVALID
    int a;

// Error: delegate onlineapp.S2.__lambda2 cannot be struct members

Nov 10 2020