Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-28112

Declaration inside switch block causes indentation havoc down the code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Not Evaluated Not Evaluated
    • None
    • Qt Creator 5.0.1
    • C/C++/Obj-C++ Support

      Typing

      switch {
      int tmp;

      case 1:

      will make default indent to go too right (see screenshot).

      Switch body statements should be indented relative to case label.

      What makes this bug entertaining is that this effect can leak outside the function.
      First, I thought it is because "for (auto&&" which is at least underlined in red
      but no.

      It is extremely unintuitive because declaration inside switch block is legal and
      it is indented correctly itself (1 indent after scope starts) and there is no red
      underlining which could help.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            artem.sokolovskii Artem Sokolovskii (Inactive)
            adobriyan A D
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes