This documentation is archived and is not being maintained.

Compiler Warning (level 3) C4062

enumerator 'identifier' in switch of enum 'enumeration' is not handled

The enumerate has no associated handler in a switch statement, and there is no default label.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4062:

// C4062.cpp
// compile with: /W3
#pragma warning(default : 4062)
enum E { a, b, c };
void func ( E e ) {
   switch(e) {
      case a:
      case b:
      break;   // no default label
   }   // C4062, enumerate 'c' not handled

int main() {