Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
Qt Creator 11.0.3, Qt Creator 12.0.1
-
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.