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

Structured bindings are not shown in Locals view nor accessible when hovering while debugging

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • Qt Creator 11.0.3, Qt Creator 12.0.1
    • Debugger
    • None
    • Seems Clang-only

    Description

      When stepping through a piece of code using structured bindings, the debugger seems unaware of the values of the proxy variables introduced by this construct.

      They do not appear in the Locals list nor does hovering the mouse over them in the editor while debugging give any information as to their runtime values.

      This was tested on macOS with LLDB but I would think other platforms (CDB, GDB) are also affected in a similar manner.

      Any code with a structured binding suffers from it, e.g.

      #include <string>
      using namespace std::literals;
      
      struct Stuff
      {
          int num;
          std::string nam;
      };
      
      int main()
      {
          Stuff stuff{42, "forty-two"s};
      
          const auto& [number, name] = stuff;
      
          std::cout << "number: " << number << ", "
                    << "name: " << name << '\n';
      }

      This exhibits the issue (see screenshot). Changing the struct Stuff to an std::pair allows the hover-over to show the value of number and name, but these "proxy-variables" do not show up in the Locals view in either case.

      Note that the above example is of course trivial and the values are readily accessible through "stuff", but in a lot of cases where structured bindings are used, you do not have that so clearly available, and the code you're debugging is using the structured binding proxy variables directly instead, so being able to read their values is a very useful feature.

      Attachments

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

        Activity

          People

            hjk hjk
            ruben.vanboxem Ruben Van Boxem
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes