Bug 16644 – final switch on int should error unless VRP matches all cases

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-28T23:16:25Z
Last change time
2024-12-13T18:50:30Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#19202 →

Comments

Comment #0 by code — 2016-10-28T23:16:25Z
To determine whether all cases are handled, we could use value range propagation. OK final switch (i % 2) { case 0: case 1: } ERROR final switch (i % 3) { case 0: case 1: } In cases where we don't know the range, it should be an error.
Comment #1 by robert.schadek — 2024-12-13T18:50:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19202 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB