Bug 22006 – static foreach and foreach over tuple doesn't work on 16-bit

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-08T15:41:51Z
Last change time
2021-06-11T17:17:54Z
Keywords
pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2021-06-08T15:41:51Z
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.
Comment #1 by dlang-bot — 2021-06-09T16:08:14Z
@ibuclaw created dlang/dmd pull request #12662 "fix Issue 22006 - static foreach and foreach over tuple doesn't work on 16-bit" fixing this issue: - fix Issue 22006 - static foreach and foreach over tuple doesn't work on 16-bit https://github.com/dlang/dmd/pull/12662
Comment #2 by dlang-bot — 2021-06-09T18:41:40Z
dlang/dmd pull request #12662 "fix Issue 22006 - static foreach and foreach over tuple doesn't work on 16-bit" was merged into master: - 770190cef40410aa08be2c8942733ece6a880c3a by Iain Buclaw: fix Issue 22006 - static foreach and foreach over tuple doesn't work on 16-bit https://github.com/dlang/dmd/pull/12662
Comment #3 by dlang-bot — 2021-06-11T17:17:54Z
dlang/dmd pull request #12668 "[dmd-cxx] Backport recent bug fixes for static foreach ICEs" was merged into dmd-cxx: - a8a7fcd8c057dab7a689c51dfbb80506f3d068ca by Iain Buclaw: [dmd-cxx] fix Issue 22006 - static foreach and foreach over tuple doesn't work on 16-bit (#12662) https://github.com/dlang/dmd/pull/12668