diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index 5be49f63898..7e03f5b2ab1 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 b012bf07940..ada9697e32b 100644 --- a/tests/manual/gdbdebugger/boost/main.cpp +++ b/tests/manual/gdbdebugger/boost/main.cpp @@ -1,5 +1,6 @@ #include +#include using namespace boost; @@ -19,7 +20,10 @@ void testOptional() optional i; optional d; optional l; + optional sr; + std::string as = "hallo"; i = 1; + sr = as; l = Large(); i = 2; i = 3;