◄Up► ◄Contents► ◄Index► ◄Back► ──────────────────────────────────────────────────────────────────────────── Compiler error C2450 switch expression of type 'type' is illegal The specified switch expression evaluated to an illegal type. A switch expression must evaluate to an integral type or a class type that has an unambiguous conversion to an integral type. If the expression evaluates to a user-defined type, a conversion operator needs to be supplied. The following is an example of this error: 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: ; } } -♦-