PR c++/29503 points out that something like "b->Base::member" will
crash when 'b' does not have pointer type. This seems to be a simple
oversight in eval_op_member.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29503
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
case TYPE_CODE_MEMBERPTR:
/* Now, convert these values to an address. */
+ if (check_typedef (value_type (arg1))->code () != TYPE_CODE_PTR)
+ arg1 = value_addr (arg1);
arg1 = value_cast_pointers (lookup_pointer_type (TYPE_SELF_TYPE (type)),
arg1, 1);
gdb_test "print n.A1::y" " = 2"
gdb_test "print n.A2::x" " = 3"
gdb_test "print n.A2::y" " = 4"
+ gdb_test "print n->A2::y" " = 4"
gdb_test "print n.w" " = 5"
gdb_test "print n.r" " = 6"
gdb_test "print n.z" " = 7"