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