switch expression of type 'type' is illegal
The switch expression evaluates to an illegal type. It must evaluate to an integer type or a class type with unambiguous conversion to an integer type. If it evaluates to a user-defined type, you must supply a conversion operator.
Example
class X { public: int i; } x; class Y { public: int i; operator int() { return i; } // conversion operator } y; void main() { int j = 1; switch ( x ) // error, x is not type int { default: ; } switch ( y ) // OK { default: ; } }