www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22672] New: Allow casting from TypeTuple to TypeTuple

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

          Issue ID: 22672
           Summary: Allow casting from TypeTuple to TypeTuple
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: hinoda2002 outlook.jp

Currently DMD does not allow casting to TypeTuple even if they
are the same type is.

---
alias Tuple(T...) = T;

void foo()
{
    Tuple!(int, int) tup;
    cast(Tuple!(int, int)) tup; // Error: cannot cast `tuple(__tup_field_0,
__tup_field_1)` to tuple type `(int, int)`
}
---

This is a bit odd, so I think it would be better it only allows it in certain
case.

--
Jan 13 2022