Bug 4540 – Better error message for wrong switch type

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-07-31T04:29:00Z
Last change time
2013-01-11T00:35:26Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-07-31T04:29:59Z
This is a wrong D2 program: void main() { float x; switch (x) { default: } } dmd 2.047 prints: test.d(3): Error: 'x' is not of integral type, it is a float But in D strings too are allowed in switch, so a better error message can be: test.d(3): Error: 'x' is not of integral type or string, it is a float
Comment #1 by andrej.mitrovich — 2012-12-27T18:23:30Z
Comment #2 by github-bugzilla — 2013-01-10T23:54:43Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8ab6ab22b7e7d160732d72c71e9953e750f6b1be Fixes Issue 4540 - Better diagnostic for wrong switch type. https://github.com/D-Programming-Language/dmd/commit/98e20bc85dbfd63e11a607c813fc6ae73554b631 Merge pull request #1417 from AndrejMitrovic/Fix4540 Issue 4540 - Better diagnostic for wrong switch type.