OSDN Git Service

* call.c (add_template_candidate_real): Handle member template
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 May 2000 06:53:04 +0000 (06:53 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 May 2000 06:53:04 +0000 (06:53 +0000)
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

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/ir.texi
gcc/testsuite/g++.old-deja/g++.other/vbase3.C [new file with mode: 0644]

index e6cdcd2..e707054 100644 (file)
@@ -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>
index acb5cfe..eea70a6 100644 (file)
@@ -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;
index 9c317e4..61165b7 100644 (file)
@@ -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 (file)
index 0000000..6d61118
--- /dev/null
@@ -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);
+}