[Issue 23360] Template alias to tuple member variable doesn't expand

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 22 13:20:46 UTC 2022


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

--- Comment #1 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Note that the following alternatives compile successfully:

---
    // OK - use foo.tuple directly
    AliasSeq!(int) t = foo.tuple;
---


---
    // OK - attach the `this` reference explicitly
    AliasSeq!(int) t = __traits(child, foo, Foo.slice!());
---


...although the __traits(child) workaround fails in the general case, when the
tuple has more than one element:

---
alias AliasSeq(Args...) = Args;

struct Foo {    
    AliasSeq!(int, int) tuple;    
    alias slice() = tuple;    
}

void main() {    
    Foo foo;
    AliasSeq!(int, int) t = __traits(child, foo, Foo.slice!());
    // Error: expected 2 arguments for `child` but had 3
}
---

--


More information about the Digitalmars-d-bugs mailing list