diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index 5be49f63898cf4b64881f2da5d8f332f5ffffec8..7e03f5b2ab11198b64271f178fea1efc72804f09 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -2080,7 +2080,12 @@ def qdump__boost__optional(d, item): else: d.putType(item.value.type, d.currentTypePriority + 1) type = item.value.type.template_argument(0) - d.putItemHelper(Item(item.value["m_storage"].cast(type), item.iname)) + storage = item.value["m_storage"] + if type.code == gdb.TYPE_CODE_REF: + value = storage.cast(type.target().pointer()).dereference() + else: + value = storage.cast(type) + d.putItemHelper(Item(value, item.iname)) ####################################################################### diff --git a/tests/manual/gdbdebugger/boost/main.cpp b/tests/manual/gdbdebugger/boost/main.cpp index b012bf07940f4ae89c6b47d0fbc352536ab4a2d2..ada9697e32b759a7871b2dc203774931bbaa6d22 100644 --- a/tests/manual/gdbdebugger/boost/main.cpp +++ b/tests/manual/gdbdebugger/boost/main.cpp @@ -1,5 +1,6 @@ #include <boost/optional.hpp> +#include <string> using namespace boost; @@ -19,7 +20,10 @@ void testOptional() optional<int> i; optional<double> d; optional<Large> l; + optional<std::string &> sr; + std::string as = "hallo"; i = 1; + sr = as; l = Large(); i = 2; i = 3;