forked from Imagelibrary/binutils-gdb
Allow calling of variadic C++ functions
Currently, it's not possible to call a variadic C++ function: ``` (gdb) print sum_vararg_int(1, 10) Cannot resolve function sum_vararg_int to any overloaded instance (gdb) print sum_vararg_int(2, 20, 30) Cannot resolve function sum_vararg_int to any overloaded instance ``` It's because all additional arguments get the TOO_FEW_PARAMS_BADNESS rank by rank_function, which disqualifies the function. To fix this, I've created the new VARARG_BADNESS rank, which is used only for additional arguments of variadic functions, allowing them to be called: ``` (gdb) print sum_vararg_int(1, 10) $1 = 10 (gdb) print sum_vararg_int(2, 20, 30) $2 = 50 ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28589 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -2735,7 +2735,8 @@ extern int compare_badness (const badness_vector &,
|
||||
const badness_vector &);
|
||||
|
||||
extern badness_vector rank_function (gdb::array_view<type *> parms,
|
||||
gdb::array_view<value *> args);
|
||||
gdb::array_view<value *> args,
|
||||
bool varargs = false);
|
||||
|
||||
extern struct rank rank_one_type (struct type *, struct type *,
|
||||
struct value *);
|
||||
|
||||
Reference in New Issue
Block a user