> That change to value_rtti_indirect_type would be easier to read if it was > a separate patch. This is the first part of my previous patch that contains the change to value_rtti_indirect_type. The second part requires this one to be applied, so I'll provide it after commit. Here is an example of what this patch fixes: struct Base { virtual ~Base() {} }; struct Derived: public Base {}; int main() { Derived i; const Base& ri = i; const Base* pi = &i; return 0; // <= run until this line } The "whatis ri" command fails with message: "Attempt to take contents of a non-pointer value.". The "whatis pi" command does not respect cv-qualifiers: type = /* real type = Derived * */ const Base * This patch fixes these problems and takes into account the last Jan's review. gdb/ChangeLog: 2012-01-06 Anton Gorenkov * c-valprint.c (c_value_print): Use value_rtti_indirect_type instead of value_rtti_target_type. * eval.c (evaluate_subexp_standard): Use value_rtti_indirect_type instead of value_rtti_target_type. * typeprint.c (whatis_exp): Use value_rtti_indirect_type instead of value_rtti_target_type. * valops.c (value_ind): Extract function readjust_indirect_value_type. (value_rtti_indirect_type): The replacement for value_rtti_target_type. * value.c (readjust_indirect_value_type): New function. (coerce_ref): Support for enclosing type setting for references with readjust_indirect_value_type. * value.h (readjust_value_type): The replacement for value_rtti_target_type.