Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 12, 2012 [Issue 8807] New: Better error messages for a switch on doubles | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@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: ------- |
January 10, 2013 [Issue 8807] Better error messages for a switch on doubles | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8807 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-10 15:50:45 PST --- (In reply to comment #0) > temp2.d(3): Error: 'value' is not of integral type, it is a double This is solved in pull for Issue 4540. > temp2.d(4): Error: case must be a string or an integral constant, not 1 > - The second error message is just wrong, because 1 is on default an integral > constant. It's not actually wrong, 1 is implicitly converted to type double. Unfortunately it doesn't print 1.0 to make it obvious. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 20, 2013 [Issue 8807] Better error messages for a switch on doubles | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8807 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Platform|x86 |All AssignedTo|nobody@puremagic.com |andrej.mitrovich@gmail.com OS/Version|Windows |All --- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-19 19:59:16 PST --- https://github.com/D-Programming-Language/dmd/pull/1514 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 20, 2013 [Issue 8807] Better error messages for a switch on doubles | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=8807 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME --- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-20 10:00:49 PST --- (In reply to comment #2) > https://github.com/D-Programming-Language/dmd/pull/1514 #1 is resolved, but I'm opening a separate issue for the case of printing '1.0' as '1' because it's a more general problem unrelated to the switch statement. http://d.puremagic.com/issues/show_bug.cgi?id=9357 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation