www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23704] New: need `this` for a function accessed through a

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

          Issue ID: 23704
           Summary: need `this` for a function accessed through a member
                    alias tuple
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

alias aliases(a...) = a;

struct V
{
    int _0() { return 0; }
    int _1;

    alias t = aliases!(_0, _1);
    alias t this;
}

void main()
{
    V v;

    auto x1 = v[0]; // fails
    auto x2 = v.t[0]; // fails
    auto x3 = v[1]; // ok
    auto x4 = v.t[1]; // ok
}

--
Feb 12 2023