A switch-label can be placed anywhere within the statements that form the body of a switch statement, potentially leading to unstructured code. To
prevent this from happening, the scope of a case-label or default-label shall be the statement forming the body of a switch statement. All
case-clauses and the default-clause shall be at the same scope.
Noncompliant code example
switch (x) {
case 1: // Compliant
if (foo) {
case 2: // Noncompliant
break;
default: // Noncompliant
break;
}
break;
default: // Compliant
break;
}