V7031. Suspicious label was found inside a 'switch' statement. This may be a typo, and another label was intended instead.
The analyzer has detected a label inside the switch statement that differs from the case or default clauses. This looks like a typo. As a result, the intended branch never executes.
Look at the example:
switch (status) {
case 1:
handleActive();
break;
case 2:
handlePending();
break;
defalt:
handleUnknown();
break;
}
The code looks like it should call handleUnknown for all status values besides 1 and 2. In fact, this will not happen, since defalt is an ordinary label rather than the default clause. The call to handleUnknown is unreachable for any status value.
The fixed code:
switch (status) {
case 1:
handleActive();
break;
case 2:
handlePending();
break;
default:
handleUnknown();
break;
}