aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/overload.cc
AgeCommit message (Collapse)AuthorFilesLines
2022-02-23Fix bug in C++ overload resolutionTom Tromey1-0/+10
PR c++/28901 points out a bug in C++ overload resolution. When comparing two overloads, one might be better than the other for certain parameters -- but, if that one also has some invalid conversion, then it should never be considered the better choice. Instead, a valid-but-not-apparently-quite-as-good overload should be preferred. This patch fixes this problem by changing how overload comparisons are done. I don't believe it should affect any currently valid overload resolution; nor should it affect resolutions where all the choices are equally invalid.
2013-03-15 PR c++/15116:Tom Tromey1-0/+2
* gdbtypes.c (types_equal): Handle TYPE_CODE_FUNC. gdb/testsuite * gdb.cp/overload.cc (intintfunc): New. * gdb.cp/overload.exp: Add regression test.
2011-12-13gdb/doc/Pedro Alves1-5/+0
2011-12-13 Pedro Alves <pedro@codesourcery.com> * gdb.texinfo (Implementing a Remote Stub): Explain that you should transfer control to the stub in the startup code instead of in main. Mention the need to get past the initial breakpoint. gdb/testsuite/ 2011-12-13 Pedro Alves <pedro@codesourcery.com> Doug Evans <dje@google.com> * lib/gdb.exp (gdb_run_cmd, runto_main, gdb_compile) (clean_restart): Remove references to the gdb_stub target board variable. (gdb_step_for_stub): Delete. * gdb.base/annota1.exp: Remove all references to [target_info exists gdb_stub], gdb_step_for_stub and usestubs. * gdb.base/annota3.exp: Ditto. * gdb.base/async.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/completion.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/consecutive.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/define.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/environ.exp: Ditto. * gdb.base/gnu-ifunc.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/sect-cmd.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/unload.exp: Ditto. * gdb.base/watchpoint-solib.exp: Ditto. * gdb.cp/annota2.exp: Ditto. * gdb.cp/annota3.exp: Ditto. * gdb.dwarf2/dw2-inline-param.exp: Ditto. * gdb.hp/gdb.compat/xdb1.exp: Ditto. * gdb.mi/mi-pending.exp: Ditto. * gdb.trace/circ.exp: Ditto. * gdb.cp/ovldbreak.exp: Ditto. Adjust expected line numbers. * gdb.base/list.exp: Ditto. * gdb.base/all-types.c: Remove all calls to set_debug_traps and breakpoint function and all references to the usestubs macro. * gdb.base/exprs.c: Ditto. * gdb.base/freebpcmd.c: Ditto. * gdb.base/bitfields.c: Ditto. * gdb.base/bitfields2.c: Ditto. * gdb.base/break.c: Ditto. * gdb.base/call-sc.c: Ditto. * gdb.base/call-signals.c: Ditto. * gdb.base/callfuncs.c: Ditto. * gdb.base/charset.c: Ditto. * gdb.base/consecutive.c: Ditto. * gdb.base/constvars.c: Ditto. * gdb.base/funcargs.c: Ditto. * gdb.base/int-type.c: Ditto. * gdb.base/interrupt.c: Ditto. * gdb.base/langs0.c: Ditto. * gdb.base/list0.c: Ditto. * gdb.base/mips_pro.c: Ditto. * gdb.base/miscexprs.c: Ditto. * gdb.base/nodebug.c: Ditto. * gdb.base/opaque0.c: Ditto. * gdb.base/pointers.c: Ditto. * gdb.base/printcmds.c: Ditto. * gdb.base/ptype.c: Ditto. * gdb.base/recurse.c: Ditto. * gdb.base/reread1.c: Ditto. * gdb.base/reread2.c: Ditto. * gdb.base/restore.c: Ditto. * gdb.base/return.c: Ditto. * gdb.base/run.c: Ditto. * gdb.base/scope0.c: Ditto. * gdb.base/sepdebug.c: Ditto. * gdb.base/setshow.c: Ditto. * gdb.base/setvar.c: Ditto. * gdb.base/sigall.c: Ditto. * gdb.base/signals.c: Ditto. * gdb.base/structs.c: Ditto. * gdb.base/structs2.c: Ditto. * gdb.base/testenv.c: Ditto. * gdb.base/twice.c: Ditto. * gdb.base/unwindonsignal.c: Ditto. * gdb.base/watchpoint.c: Ditto. * gdb.base/watchpoints.c: Ditto. * gdb.base/whatis.c: Ditto. * gdb.cp/classes.cc: Ditto. * gdb.cp/cplusfuncs.cc: Ditto. * gdb.cp/derivation.cc: Ditto. * gdb.cp/formatted-ref.cc: Ditto. * gdb.cp/misc.cc: Ditto. * gdb.cp/overload.cc: Ditto. * gdb.cp/ovldbreak.cc: Ditto. * gdb.cp/ref-params.cc: Ditto. * gdb.cp/ref-types.cc: Ditto. * gdb.cp/templates.cc: Ditto. * gdb.cp/virtfunc.cc: Ditto. * gdb.hp/gdb.aCC/run.c: Ditto. * gdb.hp/gdb.base-hp/callfwmall.c: Ditto. * gdb.hp/gdb.compat/xdb0.c: Ditto. * gdb.reverse/consecutive-reverse.c: Ditto. * gdb.reverse/sigall-reverse.c: Ditto. * gdb.reverse/until-reverse.c: Ditto. * gdb.reverse/watch-reverse.c: Ditto. * gdb.trace/actions.c: Ditto. * gdb.trace/circ.c: Ditto. * gdb.trace/collection.c: Ditto.
2011-02-282011-02-28 Michael Snyder <msnyder@vmware.com>Michael Snyder1-1/+1
* gdb.cp/overload.cc: Change initializer value to integer.
2010-11-04Fix derived class overload problem.Sami Wagiaalla1-0/+18
2010-11-04 Sami Wagiaalla <swagiaal@redhat.com> * gdbtypes.h (struct rank): Created subrank. * gdbtypes.c: Initialized subrank for all 'BADNESS' constants. (distance_to_ancestor): New function. (is_ancestor): Use distance_to_ancestor. (is_public_ancestor): Ditto. (sum_ranks): Handle subrank. (compare_ranks): Ditto. (rank_one_type): Subrank base conversions. 2010-11-04 Sami Wagiaalla <swagiaal@redhat.com> * gdb.cp/overload.exp: Added test for inheritance overload. * gdb.cp/overload.cc: Ditto. * gdb.cp/oranking.exp: Removed releveant kfails.
2010-10-14Fixed void* vs int* overload issue (PR C++/10343).Sami Wagiaalla1-0/+7
2010-10-14 Sami Wagiaalla <swagiaal@redhat.com> * gdbtypes.h: Create BASE_PTR_CONVERSION_BADNESS. * gdbtypes.c (rank_one_type): Move type comparison code out of here to... (types_equal): ...here. And changed it as follows: Outside of typedefs type must be of the same TYPE_CODE. When compairing two pointers or references they are equal if their targets are equal. Correct pointer conversions. 2010-10-14 Sami Wagiaalla <swagiaal@redhat.com> * gdb.cp/converts.cc: New test program. * gdb.cp/converts.exp: New test. * gdb.cp/overload.exp: Added test for void* vs int*. * gdb.cp/overload.exp: Ditto. * gdb.cp/oranking.exp: Removed related kfail.
2010-02-16 gdb/Daniel Jacobowitz1-4/+1
* linespec.c (decode_line_1): Handle FILE:FUNCTION even if FUNCTION contains parentheses. Improve removal of a trailing single quote. gdb/testsuite/ * gdb.base/list.exp (test_list_filename_and_function): Add test with single quotes. * gdb.cp/overload.cc (intToChar): Rewrite onto one line for easy matching. * gdb.cp/overload.exp: Add tests with filename, function, and quotes. Add KFAIL'd tests for PR gdb/11289.
2010-02-08gdbTom Tromey1-0/+22
PR c++/8017: * value.h: Update. * valops.c (search_struct_field): Make 'name' const. (search_struct_method): Likewise. (find_method_list): Make 'method' const. (value_struct_elt): Make 'name' and 'err' const. (value_find_oload_method_list): Make 'method' const. (find_overload_match): Make 'name' const. * eval.c (evaluate_subexp_standard): New locals function, function_name. <OP_FUNCALL>: Handle OP_SCOPE specially. gdb/testsuite PR c++/8017: * gdb.cp/overload.exp: Add tests. * gdb.cp/overload.cc (struct K): New. (namespace N): New. (main): Call new functions. (K::staticoverload): Define.
2009-12-28 * gdb.base/find.c (main): Reference search buffers.Daniel Jacobowitz1-0/+4
* gdb.base/included.c (main): Reference integer. * gdb.base/ptype.c (charfoo): Declare. (intfoo): Call charfoo. * gdb.base/scope0.c (useitp): New function. (usestatics): Use useitp. (useit): Add a type for val. * gdb.base/scope1.c (useit1): Take a pointer argument. (usestatics1): Update calls to useit1. * gdb.cp/call-c.cc: Declare foo. (main): Call foo. * gdb.cp/m-static.cc (main): Reference test4.elsewhere. * gdb.cp/namespace.cc (ensureOtherRefs): Declare. (main): Call C::ensureRefs and ensureOtherRefs. * gdb.cp/namespace1.cc (C::ensureOtherRefs): Also reference int variables. (ensureOtherRefs): New function. * gdb.cp/overload.cc (main): Call all overloadNamespace variants. * gdb.cp/templates.cc (main): Call t5i.value.
2004-02-022004-02-02 David Carlton <carlton@kealia.com>David Carlton1-1/+27
* valops.c (enum oload_classification): New. (find_overload_match): Break implementation into separate functions; delete #if 0'd code; look for symbols within namespaces. (find_oload_champ_namespace,find_oload_champ_namespace_loop) (find_oload_champ,oload_method_static,classify_oload_match): New. * cp-support.h: Add declaration for cp_func_name; update declaration for make_symbol_overload_list. * cp-support.c (cp_func_name): New. (overload_list_add_symbol): Fix comment, use SYMBOL_LINKAGE_NAME and SYMBOL_NATURAL_NAME. (make_symbol_overload_list): Take a function name and a namespace instead of a symbol; change implementation. (make_symbol_overload_list_using): New. (make_symbol_overload_list_qualified, read_in_psymtabs): New. 2004-02-02 David Carlton <carlton@kealia.com> * gdb.cp/overload.exp: Add overloadNamespace tests. * gdb.cp/overload.cc (dummyClass, dummyInstance): New. (overloadNamespace, XXX): New. (main): Call XXX::marker2.
2003-08-232003-08-22 Michael Chastain <mec@shout.net>Michael Chastain1-0/+168
* gdb.cp: New directory. * gdb.cp/*: Copy from gdb.c++/*. * gdb.c++/*: Remove. * Makefile.in: Change gdb.c++ to gdb.cp. * configure.in: Ditto. * configure: Regnerate.