C/C++ Compiler (cl.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
C2450
                                             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:  ;
             }
          }
                                    -♦-