Compiler Warning (level 4) C4061

enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label

The specified enumerator identifier has no associated handler in a switch statement that has a default case. The missing case might be an oversight, or it may not be an issue. It may depend on whether the enumerator is handled by the default case or not. For a related warning on unused enumerators in switch statements that have no default case, see C4062.

This warning is off by default. For more information about how to enable warnings that are off by default, see Compiler Warnings That Are Off by Default.


The following sample generates C4061; add a case for the missing enumerator to fix:

// C4061.cpp
// compile with: /W4
#pragma warning(default : 4061)

enum E { a, b, c };
void func ( E e )
      case a:
      case b:
   }   // C4061 c' not handled

int main()

See also

Compiler Warning (level 4) C4062