Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
enumerator 'identifier' in switch of
enum'enumeration' is not handled
Remarks
The enumerator identifier doesn't have a case handler associated with it in a switch statement, and there's no default label that can catch it. The missing case may be an oversight, and is a potential error in your code. For a related warning on unused enumerators in switch statements that have a default case, see C4061.
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.
Example
The following example generates C4062, and shows how to fix it:
// C4062.cpp
// compile with: /EHsc /W4
#pragma warning(default : 4062)
enum E { a, b, c };
void func ( E e ) {
switch(e) {
case a:
case b:
// case c: // to fix, uncomment this line
break; // no default label
} // C4062, enumerator 'c' not handled
}