www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17809] New: "this" is implicitly captured by template with


          Issue ID: 17809
           Summary: "this" is implicitly captured by template with alias
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

template A()
    auto A() { return this; }

template B(alias a)
    auto B() { return this; }

struct S
    int a;

    // Error: 'this' is only defined in non-static member functions, not A
    alias foo0 = A!();

    // OK ??? I don't think this should work
    alias foo1 = B!(a);

Sep 05 2017