https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104504

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
At the C/C++ level certainly not, it could be
int foo(int x, int y) {
  switch (bar (x, y)) {
    int y;
    default:
      y = x * 2;
      return y;
  }
}
and the inner y shouldn't be in scope of the switch control expression.
Now, for this particular case, it surely could be handled like:
  auto tmp_ = bar (x, y);
  {
    int y;
    switch (tmp_) {
    default:
      y = x * 2;
      return y;
    }
  }
but I really don't understand why exactly this case should get extra special
care when
  switch (x) {
  case 4:
    ++y;
  case 5:
    int y;
  default:
    y = x * 2;
    return y;
  }
can't easily.

Reply via email to