diff options
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 5a244a9..8a555f3 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1463,11 +1463,20 @@ value_addr (struct value *arg1) if (TYPE_CODE (type) == TYPE_CODE_REF) { /* Copy the value, but change the type from (T&) to (T*). We - keep the same location information, which is efficient, and - allows &(&X) to get the location containing the reference. */ + keep the same location information, which is efficient, and + allows &(&X) to get the location containing the reference. + Do the same to its enclosing type for consistency. */ + struct type *type_ptr + = lookup_pointer_type (TYPE_TARGET_TYPE (type)); + struct type *enclosing_type + = check_typedef (value_enclosing_type (arg1)); + struct type *enclosing_type_ptr + = lookup_pointer_type (TYPE_TARGET_TYPE (enclosing_type)); + arg2 = value_copy (arg1); - deprecated_set_value_type (arg2, - lookup_pointer_type (TYPE_TARGET_TYPE (type))); + deprecated_set_value_type (arg2, type_ptr); + set_value_enclosing_type (arg2, enclosing_type_ptr); + return arg2; } if (TYPE_CODE (type) == TYPE_CODE_FUNC) |