www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3376] New: [tdpl] Multiple ranged case labels don't work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3376

           Summary: [tdpl] Multiple ranged case labels don't work
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrei metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei metalanguage.com> 2009-10-08
12:00:23 PDT ---
void classify(char c) {
   write("You passed ");
   switch (c) {
      case '#': 
         writeln("a hash sign."); 
         break;
      case '0': .. case '9': 
         writeln("a digit."); 
         break;
      case 'A': .. case 'Z': case 'a' .. case 'z': 
         writeln("an ASCII character."); 
         break;
      case '.', ',', ':', ';', '!', '?': 
         writeln("a punctuation mark."); 
         break;
      default:
         writeln("quite a character!");
         break;
   }
}

The code fails to compile. If I change the line:

      case 'A': .. case 'Z': case 'a' .. case 'z': 

to:

      case 'A': .. case 'Z':

then it compiles.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3376


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario gmx.de> 2009-10-16 15:09:11
PDT ---
      case 'A': .. case 'Z': case 'a' .. case 'z': 

I'd say you have simply forgotten the colon after 'a'. With
      case 'A': .. case 'Z': case 'a': .. case 'z': 

it compiles. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 16 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3376


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from Andrei Alexandrescu <andrei metalanguage.com> 2009-10-16
15:15:41 PDT ---
(In reply to comment #1)
      case 'A': .. case 'Z': case 'a' .. case 'z': 

I'd say you have simply forgotten the colon after 'a'. With
      case 'A': .. case 'Z': case 'a': .. case 'z': 

it compiles.

Ouch. This is rather ironic in wake of the fact that I preached the helpfulness of that ':'. Thanks, and apologies to everyone for the distraction. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 16 2009