Skip to content

Commit 7bc4302

Browse files
authored
Merge pull request #1916 from corob-msft/cr-c4061-fix
Address DevCom 506570 in C4061, C4062
2 parents ea7e5eb + 90888c3 commit 7bc4302

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

docs/error-messages/compiler-warnings/compiler-warning-level-4-c4061.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Compiler Warning (level 4) C4061"
3-
ms.date: "11/30/2017"
3+
ms.date: "04/05/2019"
44
f1_keywords: ["C4061"]
55
helpviewer_keywords: ["C4061"]
66
ms.assetid: a99cf88e-7941-4519-8b1b-f6889d914b2f
@@ -9,9 +9,9 @@ ms.assetid: a99cf88e-7941-4519-8b1b-f6889d914b2f
99

1010
> enumerator '*identifier*' in switch of enum '*enumeration*' is not explicitly handled by a case label
1111
12-
The enumerator has no associated handler in a `switch` statement.
12+
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](compiler-warning-level-4-c4062.md).
1313

14-
This warning is off by default. See [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md) for more information.
14+
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](../../preprocessor/compiler-warnings-that-are-off-by-default.md).
1515

1616
## Example
1717

@@ -37,4 +37,8 @@ void func ( E e )
3737
int main()
3838
{
3939
}
40-
```
40+
```
41+
42+
## See also
43+
44+
[Compiler Warning (level 4) C4062](compiler-warning-level-4-c4062.md)
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
---
22
title: "Compiler Warning (level 4) C4062"
3-
ms.date: "11/04/2016"
3+
ms.date: "04/05/2019"
44
f1_keywords: ["C4062"]
55
helpviewer_keywords: ["C4062"]
66
ms.assetid: 36d1c6ae-c917-4b08-bf30-2eb49ee94169
77
---
88
# Compiler Warning (level 4) C4062
99

10-
enumerator 'identifier' in switch of enum 'enumeration' is not handled
10+
> enumerator '*identifier*' in switch of enum '*enumeration*' is not handled
1111
12-
The enumerate has no associated handler in a `switch` statement, and there is no **default** label.
12+
The enumerator *identifier* has no associated `case` handler 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](compiler-warning-level-4-c4061.md).
1313

14-
This warning is off by default. See [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md) for more information.
14+
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](../../preprocessor/compiler-warnings-that-are-off-by-default.md).
1515

16-
The following sample generates C4062:
16+
## Example
1717

18-
```
18+
The following sample generates C4062, and shows how to fix it:
19+
20+
```cpp
1921
// C4062.cpp
20-
// compile with: /W4
22+
// compile with: /EHsc /W4
2123
#pragma warning(default : 4062)
2224
enum E { a, b, c };
2325
void func ( E e ) {
2426
switch(e) {
2527
case a:
2628
case b:
29+
// case c: // to fix, uncomment this line
2730
break; // no default label
28-
} // C4062, enumerate 'c' not handled
31+
} // C4062, enumerator 'c' not handled
2932
}
3033

3134
int main() {
3235
}
33-
```
36+
```
37+
38+
## See also
39+
40+
[Compiler Warning (level 4) C4061](compiler-warning-level-4-c4061.md)

0 commit comments

Comments
 (0)