diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3513692..3d999e3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-12-08 Chris Moller + + PR gdb/9399 + * valops.c (value_cast_structs): Added test to return NULL if no + casting needed. + 2009-09-16 H.J. Lu PR gdb/10649 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b9039df..c00e954 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-12-08 Chris Moller + + PR gdb/9399 + * gdb.cp/virtfunc2.exp: New tests + * gdb.cp/virtfunc2.cc: New tests + * gdb.cp/Makefile.in: Added tests to EXECUTABLES + 2009-09-15 Tom Tromey * lib/mi-support.exp (mi_create_varobj): Update. diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in index 0a087c7..c990a64 100644 --- a/gdb/testsuite/gdb.cp/Makefile.in +++ b/gdb/testsuite/gdb.cp/Makefile.in @@ -4,7 +4,7 @@ srcdir = @srcdir@ EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ derivation inherit local member-ptr method misc \ overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \ - ref-types ref-params method2 pr9594 gdb2495 + ref-types ref-params method2 pr9594 gdb2495 virtfunc2 all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." diff --git a/gdb/valops.c b/gdb/valops.c index 3ad54ec..de24a68 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -232,6 +232,11 @@ value_cast_structs (struct type *type, struct value *v2) || TYPE_CODE (t2) == TYPE_CODE_UNION) && !!"Precondition is that value is of STRUCT or UNION kind"); + if ((TYPE_NAME (t1) != NULL) + && (TYPE_NAME (t2) != NULL) + && !strcmp (TYPE_NAME (t1), TYPE_NAME (t2))) + return NULL; + /* Upcasting: look in the type of the source to see if it contains the type of the target as a superclass. If so, we'll need to offset the pointer rather than just change its type. */