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

Wrong indentation after conditional operator in brace init list

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 4.2.0
    • C/C++/Obj-C++ Support
    • None

    Description

      When using the conditional operator ( ? : ) in the brace init list of a constructor's member initializer, automatic intendation in the remainder of the file gets broken. This is really annoying because it effects editing in parts of the file which are far away from the spot that triggered the issue.

      struct B
      {
          int i;
          B(bool j) :
              i { j ? 0 : 1 } // naked "? :" triggers bug
          {
                      ++i; // Wrong indentation
      } // Wrong indentation
      };
          // Wrong indentation continues...
      

      The bug does not occur when wrapping the conditional operator in parentheses.

      Attachments

        Issue Links

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

          Activity

            People

              kosjar Nikolai Kosjar
              dg0yt Kai Pastor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes