Compiler Warning (level 4) C4061

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Compiler Warning (level 4) C4061 on docs.microsoft.com. enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label

The enumerate has no associated handler in a switch statement.

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

The following sample generates C4061:

// 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()  
{  
}  

Show: