+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
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;
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;
}
}
&& 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;
}
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);
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);
/* 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