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

Wrong indentation after conditional operator in brace init list

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes