Seems like a bug to me. Tested it here, and I thought it’d maybe have something to do with missing breaks. And I’m not too sure whether a return is correct in a switch, but the unreachable code-warning to me seems like a bug.
Without break statements, it should be giving you that warning. In case 0, it sees “return a; return b;”, and since it can’t get to return b, that’s unreachable code.
If you put “break;” after each case block, it shouldn’t give the warning anymore.
@Vinceti your point is clear however I’ve never come across a compiler that has given that as an error before (although I’m not sure I’ve used that construct a heap of times). Generally a return statement seems to be considered an implicit break.
And as Jordi says it’s still a warning; presumably because the break becomes unreachable.