From: Jason Merrill Date: Thu, 16 Jul 1998 00:16:25 +0000 (+0000) Subject: decl2.c (arg_assoc_class): Also look at template arguments, if any. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00dc6358535b933b6d1d4a3773ee1c0081c36bd5;p=gcc.git decl2.c (arg_assoc_class): Also look at template arguments, if any. * 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 00ee76abda8..37a85a73d27 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +1998-07-15 Jason Merrill + + * 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 * decl2.c (add_using_namespace): Iterate over namespaces used diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 10b64bcb88c..e3f226cac4d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index fb09e8cdb80..2e8d569aa31 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 47d8c1f7537..62d061b6a44 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -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