[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: Re: problem with template members in classes with vbases (cvs
From: Mark Mitchell <mark () codesourcery ! com>
Date: 2000-05-31 6:54:37
[Download RAW message or body]
Thanks -- fixed with this patch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
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.
Index: testsuite/g++.old-deja/g++.other/vbase3.C
===================================================================
RCS file: vbase3.C
diff -N vbase3.C
*** /dev/null Tue May 5 13:32:27 1998
--- vbase3.C Tue May 30 23:50:50 2000
***************
*** 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);
+ }
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/call.c,v
retrieving revision 1.218
diff -c -p -r1.218 call.c
*** call.c 2000/05/30 17:39:59 1.218
--- call.c 2000/05/31 06:50:52
*************** add_template_candidate_real (candidates,
*** 2141,2151 ****
{
int ntparms = DECL_NTPARMS (tmpl);
tree targs = make_tree_vec (ntparms);
struct z_candidate *cand;
int i;
tree fn;
! i = fn_type_unification (tmpl, explicit_targs, targs, arglist,
return_type, strict);
if (i != 0)
--- 2141,2165 ----
{
int ntparms = DECL_NTPARMS (tmpl);
tree targs = make_tree_vec (ntparms);
+ tree args_without_in_chrg;
struct z_candidate *cand;
int i;
tree fn;
! /* 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)
*************** build_user_type_conversion_1 (totype, ex
*** 2320,2326 ****
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, t, args);
}
for (; ctors; ctors = OVL_NEXT (ctors))
--- 2334,2342 ----
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,
! in_charge_arg_for_name (complete_ctor_identifier),
! args);
args = tree_cons (NULL_TREE, t, args);
}
for (; ctors; ctors = OVL_NEXT (ctors))
*************** build_new_method_call (instance, name, a
*** 4229,4235 ****
tree explicit_targs = NULL_TREE;
tree basetype, mem_args = NULL_TREE, fns, instance_ptr;
tree pretty_name;
! tree user_args = args;
tree templates = NULL_TREE;
int template_only = 0;
--- 4245,4251 ----
tree explicit_targs = NULL_TREE;
tree basetype, mem_args = NULL_TREE, fns, instance_ptr;
tree pretty_name;
! tree user_args;
tree templates = NULL_TREE;
int template_only = 0;
*************** build_new_method_call (instance, name, a
*** 4374,4380 ****
if ((flags & LOOKUP_ONLYCONVERTING)
&& DECL_NONCONVERTING_P (t))
continue;
! if (TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE)
this_arglist = mem_args;
else
this_arglist = args;
--- 4390,4397 ----
if ((flags & LOOKUP_ONLYCONVERTING)
&& DECL_NONCONVERTING_P (t))
continue;
!
! if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
this_arglist = mem_args;
else
this_arglist = args;
Index: cp/ir.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/ir.texi,v
retrieving revision 1.29
diff -c -p -r1.29 ir.texi
*** ir.texi 2000/05/03 22:25:20 1.29
--- ir.texi 2000/05/31 06:50:55
*************** returns, control is transferred directly
*** 1038,1044 ****
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
by @code{DECL_INITIAL}; this will always be an expression for the
address of a function.
--- 1038,1056 ----
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, 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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic