[Issue 17809] New: "this" is implicitly captured by template with alias parameter

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 5 14:42:47 UTC 2017


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

          Issue ID: 17809
           Summary: "this" is implicitly captured by template with alias
                    parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: john.loughran.colvin at 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);
}

--


More information about the Digitalmars-d-bugs mailing list