* pt.c (try_one_overload): Take orig_targs again. Only check for
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Nov 1998 03:42:37 +0000 (03:42 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Nov 1998 03:42:37 +0000 (03:42 +0000)
mismatches against them; we don't care what a previous call found.
(resolve_overloaded_unification): Adjust.
* search.c (lookup_field): Don't return anything for a non-type
field from a dependent type.
* decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class
in an array declarator.
(start_decl): Push into the class before looking for the field.

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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c
gcc/cp/search.c

index 5b0ad59..475ada1 100644 (file)
@@ -1,3 +1,15 @@
+1998-11-11  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (try_one_overload): Take orig_targs again.  Only check for
+       mismatches against them; we don't care what a previous call found.
+       (resolve_overloaded_unification): Adjust.
+
+       * search.c (lookup_field): Don't return anything for a non-type
+       field from a dependent type.
+       * decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class
+       in an array declarator.
+       (start_decl): Push into the class before looking for the field.
+
 1998-11-08  Mark Mitchell  <mark@markmitchell.com>
 
        * method.c (build_overload_value): Handle REFERENCE_TYPE.
index 485d8e4..8b9bb04 100644 (file)
@@ -6658,6 +6658,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
 
   if (context && TYPE_SIZE (complete_type (context)) != NULL_TREE)
     {
+      pushclass (context, 2);
+
       if (TREE_CODE (decl) == VAR_DECL)
        {
          tree field = lookup_field (context, DECL_NAME (decl), 0, 0);
@@ -6699,8 +6701,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
       if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
        cp_pedwarn ("declaration of `%#D' outside of class is not definition",
                    decl);
-
-      pushclass (context, 2);
     }
 
 #ifdef SET_DEFAULT_DECL_ATTRIBUTES
@@ -9604,6 +9604,17 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                   constant, but we don't know what the value is yet.  */
                if (processing_template_decl)
                  {
+                   /* Resolve a qualified reference to an enumerator or
+                      static const data member of ours.  */
+                   if (TREE_CODE (size) == SCOPE_REF
+                       && TREE_OPERAND (size, 0) == current_class_type)
+                     {
+                       tree t = lookup_field (current_class_type,
+                                              TREE_OPERAND (size, 1), 0, 0);
+                       if (t)
+                         size = t;
+                     }
+
                    itype = make_node (INTEGER_TYPE);
                    TYPE_MIN_VALUE (itype) = size_zero_node;
                    TYPE_MAX_VALUE (itype) = build_min
index c1a8331..5f3fbab 100644 (file)
@@ -80,7 +80,7 @@ static int unify PROTO((tree, tree, tree, tree, int, int*));
 static int resolve_overloaded_unification PROTO((tree, tree, tree, tree,
                                                 unification_kind_t, int,
                                                 int*));
-static int try_one_overload PROTO((tree, tree, tree, tree,
+static int try_one_overload PROTO((tree, tree, tree, tree, tree,
                                   unification_kind_t, int, int*));
 static int unify PROTO((tree, tree, tree, tree, int, int*));
 static void add_pending_template PROTO((tree));
@@ -7031,7 +7031,7 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
          if (subargs)
            {
              elem = tsubst (TREE_TYPE (fn), subargs, NULL_TREE);
-             good += try_one_overload (tparms, tempargs, parm, elem,
+             good += try_one_overload (tparms, targs, tempargs, parm, elem,
                                        strict, sub_strict, explicit_mask);
            }
        }
@@ -7039,7 +7039,7 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
   else if (TREE_CODE (arg) == OVERLOAD)
     {
       for (; arg; arg = OVL_NEXT (arg))
-       good += try_one_overload (tparms, tempargs, parm,
+       good += try_one_overload (tparms, targs, tempargs, parm,
                                  TREE_TYPE (OVL_CURRENT (arg)),
                                  strict, sub_strict, explicit_mask);
     }
@@ -7073,9 +7073,9 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
    Returns 1 on success.  */
 
 static int
-try_one_overload (tparms, targs, parm, arg, strict,
+try_one_overload (tparms, orig_targs, targs, parm, arg, strict,
                  sub_strict, explicit_mask)
-     tree tparms, targs, parm, arg;
+     tree tparms, orig_targs, targs, parm, arg;
      unification_kind_t strict;
      int sub_strict;
      int* explicit_mask;
@@ -7107,11 +7107,11 @@ try_one_overload (tparms, targs, parm, arg, strict,
     return 0;
 
   /* First make sure we didn't deduce anything that conflicts with
-     previously deduced/specified args.  */
+     explicitly specified args.  */
   for (i = nargs; i--; )
     {
       tree elt = TREE_VEC_ELT (tempargs, i);
-      tree oldelt = TREE_VEC_ELT (targs, i);
+      tree oldelt = TREE_VEC_ELT (orig_targs, i);
 
       if (elt == NULL_TREE)
        continue;
index d9d945f..4157a5d 100644 (file)
@@ -1186,11 +1186,15 @@ lookup_field (xbasetype, name, protect, want_type)
        template <class T> void S<T>::I::f() {}
 
      will come through here to handle `S<T>::I'.  */
-  if (rval && TREE_CODE (rval) == TYPE_DECL
-      && processing_template_decl
+  if (rval && processing_template_decl
       && ! currently_open_class (BINFO_TYPE (rval_binfo))
       && uses_template_parms (type))
     {
+      /* Don't return a non-type.  Actually, we ought to return something
+        so lookup_name_real can give a warning.  */
+      if (TREE_CODE (rval) != TYPE_DECL)
+       return NULL_TREE;
+
       binfo = rval_binfo;
       for (; ; binfo = BINFO_INHERITANCE_CHAIN (binfo))
        if (BINFO_INHERITANCE_CHAIN (binfo) == NULL_TREE