PhobosWatch: manifest => enum

0ffh frank at youknow.what.todo.interNETz
Sun Dec 30 09:12:39 PST 2007


Janice Caron wrote:
> What I meant was: you can't switch on a heterogenous anonymous enum,
> because heterogenous anonymous enums have no type.

with

   enum
   {
     int    one   = 1;
     float  two   = 2.0;
     string three = "three";
   }

I'd expect

   void foo(int x)
   {
     switch (x)
     {
       case one: writefln("ONE"); break;     // this should be legal
       case two: writefln("TWO"); break;     // but not this
       case three: writefln("THREE"); break; // much less this
     }
   }


because to me the rule "case guards can only be of integral type"
seems to make the most sense. I'd be rather disappointed if case
one didn't work...

regards, frank





More information about the Digitalmars-d mailing list