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: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-10-12 14:38:24 PDT ---
>From the thread:
http://forum.dlang.org/thread/osnevnwnshreoaudl...@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: -------

Reply via email to