Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.38 KB

compiler-warning-level-4-c4061.md

File metadata and controls

40 lines (31 loc) · 1.38 KB
description title ms.date f1_keywords helpviewer_keywords
Learn more about: Compiler Warning (level 4, off) C4061
Compiler Warning (level 4, off) C4061
04/05/2019
C4061
C4061

Compiler Warning (level 4, off) 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. Whether the missing case is an issue in practice depends on if the default case handles the enumerator. 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.

Example

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 )
{
   switch(e)
   {
      case a:
      case b:
      default:
         break;
   }   // C4061 c' not handled
}

See also

Compiler Warning (level 4) C4062