1998-07-17 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (tsubst, case FUNCTION_DECL): Fix getting complete args for
+ a member template specialization.
+
+ * tree.c (ovl_member): Use decls_match to compare functions.
+ * decl.c (decls_match): Check the context of a function.
+
* parse.y (primary): Use notype_unqualified_id instead of IDENTIFIER
in Koenig lookup support rules.
* semantics.c (finish_call_expr): Handle the new cases.
tree p1 = TYPE_ARG_TYPES (f1);
tree p2 = TYPE_ARG_TYPES (f2);
+ if (DECL_REAL_CONTEXT (newdecl) != DECL_REAL_CONTEXT (olddecl)
+ && ! (DECL_LANGUAGE (newdecl) == lang_c
+ && DECL_LANGUAGE (olddecl) == lang_c))
+ return 0;
+
/* When we parse a static member function definition,
we put together a FUNCTION_DECL which thinks its type
is METHOD_TYPE. Change that to FUNCTION_TYPE, and
tmpl = DECL_TI_TEMPLATE (t);
/* Start by getting the innermost args. */
- argvec = tsubst (DECL_TI_ARGS (t), args, in_decl);
+ if (DECL_TEMPLATE_SPECIALIZATION (tmpl))
+ argvec = args;
+ else
+ argvec = tsubst (DECL_TI_ARGS (t), args, in_decl);
if (DECL_TEMPLATE_INFO (tmpl))
argvec = complete_template_args (tmpl, argvec, 0);
my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 283);
- /* FIXME this won't work with member templates; we only have one level
- of args here. */
+ /* Check to see if we already have this specialization. This does work
+ for member template specializations; the list is set up from the
+ tsubst TEMPLATE_DECL case when the containing class is instantiated. */
if (DECL_FUNCTION_TEMPLATE_P (tmpl))
{
- /* Check to see if we already have this specialization. */
tree spec = retrieve_specialization (tmpl, targ_ptr);
if (spec != NULL_TREE)
if (!ovl || TREE_CODE (ovl) != OVERLOAD)
return 0;
for (; ovl; ovl = OVL_CHAIN (ovl))
- if (OVL_FUNCTION (ovl) == fn)
+ if (decls_match (OVL_FUNCTION (ovl), fn))
return 1;
return 0;
}