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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 31 06:02:55 UTC 2019


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

--- Comment #1 from Suleyman Sahmi (سليمان السهمي) <sahmi.soulaimane at gmail.com> ---
If a member tuple contains functions and this tuple is unpacked with a foreach
statement then there is current usage that would break if `this` is preserved.

```
alias AliasSeq(Args...) = Args;
struct S
{
    void f() {}
    alias funcs = AliasSeq!(f);
}

unittest
{
    S obj;
    foreach (f; obj.funcs) // obj.funcs is expanded into S.f not obj.f
        pragma(msg, typeof(f));
}
```

--


More information about the Digitalmars-d-bugs mailing list