January 07, 2024
https://issues.dlang.org/show_bug.cgi?id=24321

          Issue ID: 24321
           Summary: 'need this' when accessing a mixin via an alias tuple
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: maxsamukha@gmail.com

import std.meta;

struct Foo
{
    int x;
}

mixin template Foo2()
{
    int x;
}

struct S
{
    Foo foo;
    alias foos = AliasSeq!(foo);

    mixin Foo2!() foo2;
    alias foo2s = AliasSeq!(foo2);
}

void main()
{
    S s;
    auto x = s.foos[0].x; // ok
    auto x2 = s.foo2s[0].x; // fail
}


a.d(26): Error: `this` is only defined in non-static member functions, not
`main`
a.d(26): Error: accessing non-static variable `x` requires an instance of `S`

--