NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2450

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:  ;
   }
}