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

Correct indentation doesn't work with brace initialization and the conditional assignment operator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 3.0.0, Qt Creator 3.1.0-beta
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Environment:
      QT Creator 3.0.0, MinGW 4.8, Windows 8

      Description

      "Correct indentation" doesn't work correctly if you combine brace initialization and the conditional assignment operator.

      Minimal example:
      Copy and paste the text below into the QT Creator 3.0.0 editor and try to correct the indentation (e.g. via CTRL-I).

      Input:

      int main()
      {
      int i = 1;
      int j{i?5:10};
      return 0;
      }
      
      

      Expected output:

      int main()
      {
          int i = 1;
          int j{i?5:10};
          return 0;
      }
      

      Output:

      int main()
      {
          int i = 1;
          int j{i?5:10};
                return 0;
               }
      

        Attachments

        1. Indentation.png
          Indentation.png
          10 kB
        2. main.cpp
          0.1 kB

          Issue Links

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

            Activity

              People

              • Assignee:
                kosjar Nikolai Kosjar
                Reporter:
                uli1729 Uli
              • Votes:
                5 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes