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

uniform initialization of std::bitset<> with left-shift expression ('<<') messes up later indentation

    XMLWordPrintable

Details

    • Linux/X11

    Description

      The initialization of 'leftShift' forces incorrect indentation on subsequent lines, when initializing
      with a left-shift expression. Interestingly, right-shift doesn't cause this bug.

      Everything from 'leftShifted.set(0, top);' onwards is incorrectly indented.

      std::bitset<4> rot(std::bitset<4> hbyte)
      {
          bool top {hbyte.test(3)};
          std::bitset<4> leftShifted {hbyte << 1};
                                      leftShifted.set(0, top);
                                                              return leftShifted;
                                     }
          
          int main()
          {
              std::cout << rot(0b0001) << '\n';
              std::cout << rot(0b1001) << '\n';
              return 0;
          }
      

      Attachments

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

        Activity

          People

            bci Brandon Irizarry
            bci Brandon Irizarry
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes