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

Incorrect indent after return with conditional using an array operator

    XMLWordPrintable

Details

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

    Description

      The following code causes problems

      int test()
      {
      	int arr[10];
      	bool x = false;
      
      	return x > 0 ? arr[0] : 0;   // <-- All indents following this line are 1 to the right
              }  // <-- wrong indent
      

      A workaround is to use parethesis for the return statement,

          return (x > 0 ? arr[0] : 0);
      

      This only appears to happen with the 2nd (true) statement. Having an array operator in the 3rd (false) position does not result in invalid indentation.

      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
              adamm Adam Majer
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes