Bug 24585 – Allow switch with multiple arguments

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-06-04T12:22:45Z
Last change time
2024-12-13T19:35:33Z
Assigned to
No Owner
Creator
Bolpat
Moved to GitHub: dmd#18244 →

Comments

Comment #0 by qs.il.paperinik — 2024-06-04T12:22:45Z
Allow `switch` statements to have more than one argument: `switch (x, y)`. Case labels then take the same number of arguments: `case (0, 0):` The parentheses after `case` are then required. A case label matches if it would match components individually. While this should work for all types for which `switch` works, if the type of the components’ sizes adds up to ≤ 64 bit, arguments can be connected into an `ulong` (or smaller) and checked together.
Comment #1 by robert.schadek — 2024-12-13T19:35:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18244 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB