@@ -309,7 +309,10 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
struct value *target;
int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
- target = value_ind (val);
+ if (was_pointer)
+ target = value_ind (val);
+ else
+ target = coerce_ref (val);
type = value_rtti_type (target, NULL, NULL, NULL);
if (type)
@@ -58,6 +58,8 @@ struct Derived : public Base {
};
Base *base = new Derived ();
+Derived derived;
+Base &base_ref = derived;
void ptr_ref(int*& rptr_int)
{
@@ -416,6 +416,8 @@ proc test_subscript_regression {exefile lang} {
# Likewise.
gdb_test "python print (gdb.parse_and_eval('base').dynamic_type)" \
"Derived \[*\]"
+ gdb_test "python print (gdb.parse_and_eval('base_ref').dynamic_type)" \
+ "Derived \[&\]"
# A static type case.
gdb_test "python print (gdb.parse_and_eval('5').dynamic_type)" \
"int"