* tree.c (copy_template_template_parm): Use permanent_obstack.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Jan 1999 13:32:57 +0000 (13:32 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Jan 1999 13:32:57 +0000 (13:32 +0000)
        * pt.c (unify): Remove restrictions on deduction of argument
        of template template parameters.
* rtti.c (build_dynamic_cast_1): Resolve OFFSET_REF exprs.
* class.c (resolve_address_of_overloaded_function): Show list of
all candidates, when none of them match.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24749 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/tree.c

index dfe2645..9e1a1d8 100644 (file)
@@ -1,3 +1,19 @@
+1999-01-18  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * tree.c (copy_template_template_parm): Use permanent_obstack.
+
+1999-01-18  Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+        * pt.c (unify): Remove restrictions on deduction of argument
+        of template template parameters.
+
+1999-01-18  Nathan Sidwell  <nathan@acm.org>
+
+       * rtti.c (build_dynamic_cast_1): Resolve OFFSET_REF exprs.
+
+       * class.c (resolve_address_of_overloaded_function): Show list of
+       all candidates, when none of them match.
+
 1999-01-18  Chip Salzenberg  <chip@perlsupport.com>
 
        * typeck.c (comp_ptr_ttypes_reinterpret): Per ANSI, tighten up
index 1688e02..622f079 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions related to building classes and their related objects.
-   Copyright (C) 1987, 92-97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -5188,10 +5188,18 @@ resolve_address_of_overloaded_function (target_type,
       /* There were *no* matches.  */
       if (complain)
        {
-         cp_error ("cannot convert overloaded function `%D' to type `%#T'", 
+         cp_error ("no matches converting function `%D' to type `%#T'", 
                    DECL_NAME (OVL_FUNCTION (overload)),
                    target_type);
-         cp_error ("because no suitable overload exists");
+
+         /* print_candidates expects a chain with the functions in
+             TREE_VALUE slots, so we cons one up here (we're losing anyway,
+             so why be clever?).  */
+          for (; overload; overload = OVL_NEXT (overload))
+            matches = scratch_tree_cons (NULL_TREE, OVL_CURRENT (overload),
+                                         matches);
+          
+         print_candidates (matches);
        }
       return error_mark_node;
     }
index a28751b..ad0acae 100644 (file)
@@ -7461,16 +7461,14 @@ unify (tparms, targs, parm, arg, strict, explicit_mask)
                    == error_mark_node)
                  return 1;
          
-               /* Deduce arguments T, i from TT<T> or TT<i>.  */
+               /* Deduce arguments T, i from TT<T> or TT<i>.  
+                  We check each element of PARMVEC and ARGVEC individually
+                  rather than the whole TREE_VEC since they can have
+                  different number of elements.  */
+
                for (i = 0; i < TREE_VEC_LENGTH (parmvec); ++i)
                  {
                    tree t = TREE_VEC_ELT (parmvec, i);
-                   if (TREE_CODE (t) != TEMPLATE_TYPE_PARM
-                       && TREE_CODE (t) != TEMPLATE_TEMPLATE_PARM
-                       && TREE_CODE (t) != TEMPLATE_PARM_INDEX)
-                     continue;
-
-                   /* This argument can be deduced.  */
 
                    if (unify (tparms, targs, t, 
                               TREE_VEC_ELT (argvec, i), 
index a4b35ec..fff9230 100644 (file)
@@ -456,11 +456,15 @@ build_dynamic_cast_1 (type, expr)
      tree type, expr;
 {
   enum tree_code tc = TREE_CODE (type);
-  tree exprtype = TREE_TYPE (expr);
+  tree exprtype;
   enum tree_code ec;
   tree dcast_fn;
   tree old_expr = expr;
 
+  if (TREE_CODE (expr) == OFFSET_REF)
+    expr = resolve_offset_ref (expr);
+  
+  exprtype = TREE_TYPE (expr);
   assert (exprtype != NULL_TREE);
   ec = TREE_CODE (exprtype);
 
index fdf46cf..85cd968 100644 (file)
@@ -1519,9 +1519,18 @@ copy_template_template_parm (t)
      tree t;
 {
   tree template = TYPE_NAME (t);
-  tree t2 = make_lang_type (TEMPLATE_TEMPLATE_PARM);
+  tree t2;
+
+  /* Make sure these end up on the permanent_obstack.  */
+  push_obstacks_nochange ();
+  end_temporary_allocation ();
+  
+  t2 = make_lang_type (TEMPLATE_TEMPLATE_PARM);
   template = copy_node (template);
   copy_lang_decl (template);
+
+  pop_obstacks ();
+
   TREE_TYPE (template) = t2;
   TYPE_NAME (t2) = template;
   TYPE_STUB_DECL (t2) = template;