[Issue 20470] New: accessing an AliasSeq tuple loses `this`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 30 14:35:51 UTC 2019


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

          Issue ID: 20470
           Summary: accessing an AliasSeq tuple loses `this`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: sahmi.soulaimane at gmail.com

Test case:

```
template AliasSeq(Args...) { alias Args AliasSeq; }
struct S
{
   int a, b;
   alias AliasSeq!(b, a) expandReverse;
}

unittest
{
    S obj;
    int a, b;
    obj.expandReverse = AliasSeq!(b, a); // error: need `this` for`b` ...
}
```

The only option currently where accessing a tuple doesn't lose `this` is the
following solution:

```
template AliasSeq(Args...) { alias Args AliasSeq; }

struct S
{
   AliasSeq!(int, int) expand; // this has worked since forever it seems
}

unittest
{
    S obj;
    int a, b;
    obj.expand = AliasSeq!(a, b);
}
```

--


More information about the Digitalmars-d-bugs mailing list