decl2.c (arg_assoc_class): Also look at template arguments, if any.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 16 Jul 1998 00:16:25 +0000 (00:16 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 16 Jul 1998 00:16:25 +0000 (20:16 -0400)
* decl2.c (arg_assoc_class): Also look at template arguments, if any.
(arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST.
* lex.c (looking_for_typename): Don't initialize.
* decl2.c (ambiguous_decl): Clarify error message.
* decl.c (push_using_directive): Iterate over namespaces used
indirectly.

From-SVN: r21205

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/lex.c

index 00ee76abda8351eca0bc555f47b4ccaa3df7d8fd..37a85a73d27c64d3e10b557db33f665bf1987e01 100644 (file)
@@ -1,3 +1,15 @@
+1998-07-15  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl2.c (arg_assoc_class): Also look at template arguments, if any.
+       (arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST.
+
+       * lex.c (looking_for_typename): Don't initialize.
+
+       * decl2.c (ambiguous_decl): Clarify error message.
+
+       * decl.c (push_using_directive): Iterate over namespaces used
+       indirectly.
+
 1998-07-15  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
 
        * decl2.c (add_using_namespace): Iterate over namespaces used
index 10b64bcb88c3ade2a6815083dbedd3ffc8d23711..e3f226cac4d69e6e601900c09f69af10d63754ef 100644 (file)
@@ -3856,11 +3856,17 @@ push_using_directive (used, ancestor)
      tree ancestor;
 {
   tree ud = current_binding_level->using_directives;
+  tree iter;
   
   /* Check if we already have this. */
   if (purpose_member (used, ud) != NULL_TREE)
     return NULL_TREE;
+
+  /* Recursively add all namespaces used. */
+  for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
+    push_using_directive (TREE_PURPOSE (iter), ancestor);
+
+  ud = current_binding_level->using_directives;
   ud = perm_tree_cons (used, ancestor, ud);
   current_binding_level->using_directives = ud;
   return ud;
index fb09e8cdb809da504a43dc290e2fd5c293187142..2e8d569aa310269b8e44dd85713a78d31983dcd2 100644 (file)
@@ -3937,9 +3937,9 @@ ambiguous_decl (name, old, new)
       else
        {
          /* Some declarations are functions, some are not. */
-         cp_error ("ambiguous definition `%D' used", name);
-         cp_error_at ("first definition here", BINDING_VALUE (old));
-         cp_error_at ("other definition here", BINDING_VALUE (new));
+         cp_error ("use of `%D' is ambiguous", name);
+         cp_error_at ("  first declared as `%#D' here", BINDING_VALUE (old));
+         cp_error_at ("  also declared as `%#D' here", BINDING_VALUE (new));
          return error_mark_node;
        }
     }
@@ -4239,6 +4239,15 @@ arg_assoc_class (k, type)
            && decl_namespace (TREE_VALUE (list)) == context)
          if (add_function (k, TREE_VALUE (list)))
            return 1;
+
+  /* Process template arguments.  */
+  if (CLASSTYPE_TEMPLATE_INFO (type))
+    {
+      list = innermost_args (CLASSTYPE_TI_ARGS (type), 0);
+      for (i = 0; i < TREE_VEC_LENGTH (list); ++i)
+       arg_assoc (k, TREE_VEC_ELT (list, i));
+    }
+
   return 0;
 }
 
@@ -4316,6 +4325,9 @@ arg_assoc (k, n)
      struct arg_lookup* k;
      tree n;
 {
+  if (n == error_mark_node)
+    return 0;
+
   if (TREE_CODE_CLASS (TREE_CODE (n)) == 't')
     return arg_assoc_type (k, n);
 
@@ -4324,7 +4336,7 @@ arg_assoc (k, n)
 
   if (TREE_CODE (n) == ADDR_EXPR)
     n = TREE_OPERAND (n, 0);
-  if (TREE_CODE (n) == TREE_LIST)
+  while (TREE_CODE (n) == TREE_LIST)
     n = TREE_VALUE (n);
 
   my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);
index 47d8c1f7537107bdf179ca801911b396a77efe70..62d061b6a44e609b155c872bdec7e37968fe492e 100644 (file)
@@ -2737,7 +2737,7 @@ readescape (ignore_ptr)
 /* Value is 1 (or 2) if we should try to make the next identifier look like
    a typename (when it may be a local variable or a class variable).
    Value is 0 if we treat this name in a default fashion.  */
-int looking_for_typename = 0;
+int looking_for_typename;
 
 #ifdef __GNUC__
 __inline