The following program is accepted by the CFE:
enum A {
b, c
}
int f(A? a) {
switch (a) {
case A.b:
case A.c:
return 0;
}
}
main() {
f(A.b);
}
It should be rejected, since the switch statement is non-exhaustive (it doesn't handle null), and therefore null might be returned from f, in violation of its static type. This is a soundness issue.
The following program is accepted by the CFE:
It should be rejected, since the
switchstatement is non-exhaustive (it doesn't handlenull), and thereforenullmight be returned fromf, in violation of its static type. This is a soundness issue.