diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-31 06:53:04 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-31 06:53:04 +0000 |
commit | 009e05229d7389d5c34c4e79b9fad72351572abd (patch) | |
tree | 46d79e4b598f15e2e38e848b21b755e2a3b56d92 | |
parent | 2230aa5d038a718440d01b86e693f5cfd3cf7b2c (diff) | |
download | gcc-009e05229d7389d5c34c4e79b9fad72351572abd.tar.gz |
* call.c (add_template_candidate_real): Handle member template
constructors for classes with virtual bases.
(build_user_type_conversion_1): Use in_charge_arg_for_name.
(build_new_method_call): Use DECL_NONSTATIC_MEMBER_FUNCTION_P.
* ir.texi: Update thunk documentation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34284 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/call.c | 25 | ||||
-rw-r--r-- | gcc/cp/ir.texi | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/vbase3.C | 21 |
4 files changed, 62 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e6cdcd2c9ba..e707054b6c4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 2000-05-30 Mark Mitchell <mark@codesourcery.com> + * call.c (add_template_candidate_real): Handle member template + constructors for classes with virtual bases. + (build_user_type_conversion_1): Use in_charge_arg_for_name. + (build_new_method_call): Use DECL_NONSTATIC_MEMBER_FUNCTION_P. + + * ir.texi: Update thunk documentation. + * call.c (joust): Fix handling of overloaded builtin operators. 2000-05-30 Zack Weinberg <zack@wolery.cumb.org> diff --git a/gcc/cp/call.c b/gcc/cp/call.c index acb5cfeced3..eea70a6ef23 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2141,11 +2141,25 @@ add_template_candidate_real (candidates, tmpl, ctype, explicit_targs, { int ntparms = DECL_NTPARMS (tmpl); tree targs = make_tree_vec (ntparms); + tree args_without_in_chrg; struct z_candidate *cand; int i; tree fn; - i = fn_type_unification (tmpl, explicit_targs, targs, arglist, + /* TEMPLATE_DECLs do not have the in-charge parameter, nor the VTT + parameter. So, skip it here before attempting to perform + argument deduction. */ + if ((DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (tmpl) + || DECL_BASE_CONSTRUCTOR_P (tmpl)) + && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (tmpl))) + args_without_in_chrg = tree_cons (NULL_TREE, + TREE_VALUE (arglist), + TREE_CHAIN (TREE_CHAIN (arglist))); + else + args_without_in_chrg = arglist; + + i = fn_type_unification (tmpl, explicit_targs, targs, + args_without_in_chrg, return_type, strict); if (i != 0) @@ -2320,7 +2334,9 @@ build_user_type_conversion_1 (totype, expr, flags) TREE_TYPE (t) = build_pointer_type (totype); args = build_tree_list (NULL_TREE, expr); if (DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors))) - args = tree_cons (NULL_TREE, integer_one_node, args); + args = tree_cons (NULL_TREE, + in_charge_arg_for_name (complete_ctor_identifier), + args); args = tree_cons (NULL_TREE, t, args); } for (; ctors; ctors = OVL_NEXT (ctors)) @@ -4229,7 +4245,7 @@ build_new_method_call (instance, name, args, basetype_path, flags) tree explicit_targs = NULL_TREE; tree basetype, mem_args = NULL_TREE, fns, instance_ptr; tree pretty_name; - tree user_args = args; + tree user_args; tree templates = NULL_TREE; int template_only = 0; @@ -4374,7 +4390,8 @@ build_new_method_call (instance, name, args, basetype_path, flags) if ((flags & LOOKUP_ONLYCONVERTING) && DECL_NONCONVERTING_P (t)) continue; - if (TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE) + + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) this_arglist = mem_args; else this_arglist = args; diff --git a/gcc/cp/ir.texi b/gcc/cp/ir.texi index 9c317e4f5ab..61165b7fa80 100644 --- a/gcc/cp/ir.texi +++ b/gcc/cp/ir.texi @@ -1038,7 +1038,19 @@ returns, control is transferred directly to the caller, without returning to the thunk. The first parameter to the thunk is always the @code{this} pointer; the thunk should add @code{THUNK_DELTA} to this value. (The @code{THUNK_DELTA} is an @code{int}, not an -@code{INTEGER_CST}.) Then, the thunk should jump to the location given +@code{INTEGER_CST}.) + +Then, if @code{THUNK_VCALL_OFFSET} (also an @code{int}) is non-zero the +adjusted @code{this} pointer must be adjusted again. The complete +calculation is given by the following pseudo-code: + +@example +this += THUNK_DELTA +if (THUNK_VCALL_OFFSET) + this += (*((ptrdiff_t **) this))[THUNK_VCALL_OFFSET] +@end example + +Finally, the thunk should jump to the location given by @code{DECL_INITIAL}; this will always be an expression for the address of a function. diff --git a/gcc/testsuite/g++.old-deja/g++.other/vbase3.C b/gcc/testsuite/g++.old-deja/g++.other/vbase3.C new file mode 100644 index 00000000000..6d611186c4f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/vbase3.C @@ -0,0 +1,21 @@ +// Build don't link: +// Origin: scott snyder <snyder@fnal.gov> + +class d0_Collection_Base {}; + +template <class T> +class d0_List + : virtual public d0_Collection_Base +{ +public: + d0_List (); + + template <class Input_Iterator> + d0_List (Input_Iterator first, Input_Iterator last) + ; +}; + +void tlist () +{ + const d0_List<int> l4 (1, 2); +} |