www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23360] New: Template alias to tuple member variable doesn't


          Issue ID: 23360
           Summary: Template alias to tuple member variable doesn't expand
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.100.2, the following program fails to compile:

alias AliasSeq(Args...) = Args;

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

void main() {    
    Foo foo;
    AliasSeq!(int) t = foo.slice!();

The error message is:

bug.d(10): Error: cannot implicitly convert expression
`foo.tuple(__tuple_field_0)` of type `(int)` to `int`

In other words, the tuple expression on the right-hand side is not expanded,
which causes a type mismatch.

Sep 22 2022