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

Incorrect Indentation - C++11 Template Syntax

XMLWordPrintable

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

      When declaring/defining templates in C++11, we can now avoid putting spaces between angle brackets. As an example, the following compiles:

      template <BufferTarget Target, typename Traits = BufferTraits<Target>>
      class Buffer
      {/* cursor here */
      }
      

      Suppose the cursor is set right behind the the opening curly brace. When pressing 'Return' or 'Enter', the assumed effect is that the cursor will be placed on the following line, with the appropriate indentation relative to the opening curly brace.

      Currently, however, Qt Creator will indent the cursor to a position aligned with 'Target', right after the second opening angle bracket. This is extremely annoying.

      The work-around is to simply use C++03 syntax. Then the indentation is fine.

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

            kosjar Nikolai Kosjar
            thokra Thomas Kranz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes