www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20896] New: this.__lambda2 has no value when trying to


          Issue ID: 20896
           Summary: this.__lambda2 has no value when trying to evaluate
                    length of AliasSeq
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

Just referring to a template parameter list containing a lambda can cause a
compile error:

struct S {
    int i = bug!(a => "b");

auto bug(fns...)() {
    return fns.length; // this.__lambda2 has no value

Moving the assignment outside of S makes the error go away, so it might be DMD
wants it to have a context pointer, which is unnecessary in this case.

Jun 05 2020