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

Declaration inside switch block causes indentation havoc down the code

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Activity

          People

            artem.sokolovskii Artem Sokolovskii
            adobriyan A D
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: