Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.42 KB

compiler-warning-level-4-c4061.md

File metadata and controls

45 lines (35 loc) · 1.42 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 4) C4061
Compiler Warning (level 4) C4061
04/05/2019
C4061
C4061
a99cf88e-7941-4519-8b1b-f6889d914b2f

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.

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
}

int main()
{
}

See also

Compiler Warning (level 4) C4062