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

Identation level error after a nice lambda in C++

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 4.5.0
    • C/C++/Obj-C++ Support
    • None
    • Probably not relevant, but archlinux current.

    Description

      #include <vector>
      struct my_object;
      
      void f()
      {
          std::vector<my_object> objects;
          auto pid2p = [&objects](const my_object *o) -> entity * { return o ? &objects[reinterpret_cast<std::uintptr_t>(o) - 1] : nullptr; };
      
              // Incorrect ident
      }
      

      After the lambda definition, Ctrl-I wants to indent by two levels instead of the correct one.  The lambda recreates a real pointer from an index stored in the pointer memory with a 1-offset (e.g. nullptr is invariant).

       

      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
              galibert Olivier Galibert
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes