編譯器警告 (層級 3) C4062

列舉值 'identifier' (位於列舉 'enumeration' 的 switch 中) 沒有被處理

此列舉在 switch 陳述式中沒有關聯的處理常式,且沒有 default 標記。

此警告在預設情況下為關閉的。 如需詳細資訊,請參閱預設為關閉的編譯器警告

下列範例會產生 C4062:

// C4062.cpp
// compile with: /W3
#pragma warning(default : 4062)
enum E { a, b, c };
void func ( E e ) {
   switch(e) {
      case a:
      case b:
      break;   // no default label
   }   // C4062, enumerate 'c' not handled
}

int main() {
}