fix Issue 11822 -  switch causes ICE with  return and other stuff

This is an alternate to the fix https://github.com/D-Programming-Language/dmd/pull/3034

It includes the same test cases.