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
This commit is contained in:
Jason Merrill 1998-07-16 00:16:25 +00:00 committed by Jason Merrill
parent e3a0385963
commit 00dc635853
4 changed files with 36 additions and 6 deletions

View 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> 1998-07-15 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* decl2.c (add_using_namespace): Iterate over namespaces used * decl2.c (add_using_namespace): Iterate over namespaces used

View File

@ -3856,11 +3856,17 @@ push_using_directive (used, ancestor)
tree ancestor; tree ancestor;
{ {
tree ud = current_binding_level->using_directives; tree ud = current_binding_level->using_directives;
tree iter;
/* Check if we already have this. */ /* Check if we already have this. */
if (purpose_member (used, ud) != NULL_TREE) if (purpose_member (used, ud) != NULL_TREE)
return 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); ud = perm_tree_cons (used, ancestor, ud);
current_binding_level->using_directives = ud; current_binding_level->using_directives = ud;
return ud; return ud;

View File

@ -3937,9 +3937,9 @@ ambiguous_decl (name, old, new)
else else
{ {
/* Some declarations are functions, some are not. */ /* Some declarations are functions, some are not. */
cp_error ("ambiguous definition `%D' used", name); cp_error ("use of `%D' is ambiguous", name);
cp_error_at ("first definition here", BINDING_VALUE (old)); cp_error_at (" first declared as `%#D' here", BINDING_VALUE (old));
cp_error_at ("other definition here", BINDING_VALUE (new)); cp_error_at (" also declared as `%#D' here", BINDING_VALUE (new));
return error_mark_node; return error_mark_node;
} }
} }
@ -4239,6 +4239,15 @@ arg_assoc_class (k, type)
&& decl_namespace (TREE_VALUE (list)) == context) && decl_namespace (TREE_VALUE (list)) == context)
if (add_function (k, TREE_VALUE (list))) if (add_function (k, TREE_VALUE (list)))
return 1; 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; return 0;
} }
@ -4316,6 +4325,9 @@ arg_assoc (k, n)
struct arg_lookup* k; struct arg_lookup* k;
tree n; tree n;
{ {
if (n == error_mark_node)
return 0;
if (TREE_CODE_CLASS (TREE_CODE (n)) == 't') if (TREE_CODE_CLASS (TREE_CODE (n)) == 't')
return arg_assoc_type (k, n); return arg_assoc_type (k, n);
@ -4324,7 +4336,7 @@ arg_assoc (k, n)
if (TREE_CODE (n) == ADDR_EXPR) if (TREE_CODE (n) == ADDR_EXPR)
n = TREE_OPERAND (n, 0); n = TREE_OPERAND (n, 0);
if (TREE_CODE (n) == TREE_LIST) while (TREE_CODE (n) == TREE_LIST)
n = TREE_VALUE (n); n = TREE_VALUE (n);
my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715); my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);

View File

@ -2737,7 +2737,7 @@ readescape (ignore_ptr)
/* Value is 1 (or 2) if we should try to make the next identifier look like /* 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). 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. */ Value is 0 if we treat this name in a default fashion. */
int looking_for_typename = 0; int looking_for_typename;
#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline