[Issue 8807] New: Better error messages for a switch on doubles
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 12 14:38:25 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8807
Summary: Better error messages for a switch on doubles
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-10-12 14:38:24 PDT ---
>From the thread:
http://forum.dlang.org/thread/osnevnwnshreoaudleep@forum.dlang.org
void main() {
double value = 1;
switch (value) {
case 1:
// do something
break;
default:
}
}
DMD 2.061alpha gives:
temp2.d(3): Error: 'value' is not of integral type, it is a double
temp2.d(4): Error: case must be a string or an integral constant, not 1
The error messages are not so good:
- The first error message misses the possibility of a switch on strings.
- The second error message is just wrong, because 1 is on default an integral
constant.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list