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

Wrong auto indentation after curly brackets init that uses the conditional operator 

    XMLWordPrintable

Details

    • Windows

    Description

      Qt Creator starts to wrong the auto-indentation of the code after a variable initialization that uses curly brackets init with the conditional operator.

       

      An example below

      #include <iostream>
      #include <QString>
      
      int main(int argc, char *argv[])
      {
         int var1 = -24, var2 = 5774;
         auto longer { QString::number(var1 ).size() >= QString::number(var2).size() ? &var1 : &var2 };
         std::cout << "The int with more chars is " << *longer << std::endl;
      }
      

      If I select the whole text and I auto-indent the code the result is:

      #include <iostream>
      #include <QString>
      
      int main(int argc, char *argv[])
      {
         int var1 = -24, secondInt = 5774;
         auto longer { QString::number(var1 ).size() >= QString::number(var2).size() ? &var1 : &var2 };
                       // Starting from now the indentation is wrong
                       std::cout << "The int with more chars is " << *longer << std::endl;
                     }
      

       

      Attachments

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

        Activity

          People

            artem.sokolovskii Artem Sokolovskii (Inactive)
            lorenzoaldrighetti Lorenzo Aldrighetti
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes