From 79afc5ef5d41c629c2e26eee37aaceac4320b8d6 Mon Sep 17 00:00:00 2001 From: Sami Wagiaalla Date: Tue, 19 Oct 2010 20:53:15 +0000 Subject: Support overloading of 'operator->'. 2010-10-19 Sami Wagiaalla PR C++/11500: * valarith.c (value_x_unop): Handle STRUCTOP_PTR. * eval.c (evaluate_subexp_standard): Check for overload of 'operator->'. * valarith.c (value_x_binop): Throw NOT_FOUND_ERROR. (value_x_unop): Ditto. * valops.c: Include "exceptions.h". (find_overload_match): Throw NOT_FOUND_ERROR. (value_struct_elt): Ditto. 2010-10-19 Sami Wagiaalla * gdb.cp/smartp.exp: New test. * gdb.cp/smartp.cc : New test. --- gdb/valarith.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gdb/valarith.c') diff --git a/gdb/valarith.c b/gdb/valarith.c index 554c4ff3a29..88f1448b0dd 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -541,7 +541,8 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, } return call_function_by_hand (argvec[0], 2 - static_memfuncp, argvec + 1); } - error (_("member function %s not found"), tstr); + throw_error (NOT_FOUND_ERROR, + _("member function %s not found"), tstr); #ifdef lint return call_function_by_hand (argvec[0], 2 - static_memfuncp, argvec + 1); #endif @@ -616,6 +617,9 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) case UNOP_IND: strcpy (ptr, "*"); break; + case STRUCTOP_PTR: + strcpy (ptr, "->"); + break; default: error (_("Invalid unary operation specified.")); } @@ -641,7 +645,9 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) } return call_function_by_hand (argvec[0], nargs, argvec + 1); } - error (_("member function %s not found"), tstr); + throw_error (NOT_FOUND_ERROR, + _("member function %s not found"), tstr); + return 0; /* For lint -- never reached */ } -- cgit v1.2.1