digitalmars.D.bugs - [Issue 22006] New: static foreach and foreach over tuple doesn't
- d-bugmail puremagic.com (30/30) Jun 08 2021 https://issues.dlang.org/show_bug.cgi?id=22006
https://issues.dlang.org/show_bug.cgi?id=22006 Issue ID: 22006 Summary: static foreach and foreach over tuple doesn't work on 16-bit Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: ibuclaw gdcproject.org Despite `size_t` being a 16-bit foreach complains when the index type is a non-int, non-long type. i.e: ``` alias AliasSeq(TList...) = TList; alias size_t = ushort; void foo(int a, int b, int c) { foreach (size_t i, e; [0, 1, 2, 3]) { } // OK static foreach (size_t i, e; [0, 1, 2, 3]) { } // Error foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { } // Error } ``` Because the length of tuples are known at compile-time, there should be no reason that the same logic as static arrays isn't applied here too. --
Jun 08 2021