aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-07-17 06:19:07 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-07-17 02:19:07 -0400
commitc5a6fc4557d005e18da25fbc5c9d44bf36a12289 (patch)
treed05a1b05b8bf1555b61a5826d0c874dd2ba44bb7
parentf022f9bcfc83be98e0c6618354a0fc3f9b4df0de (diff)
downloadgcc-c5a6fc4557d005e18da25fbc5c9d44bf36a12289.zip
gcc-c5a6fc4557d005e18da25fbc5c9d44bf36a12289.tar.gz
gcc-c5a6fc4557d005e18da25fbc5c9d44bf36a12289.tar.bz2
pt.c (tsubst, [...]): Fix getting complete args for a member template specialization.
* 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. From-SVN: r21248
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/pt.c11
-rw-r--r--gcc/cp/tree.c2
4 files changed, 19 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e5cfc5e..d58646e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 38c967a..274e875 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2464,6 +2464,11 @@ decls_match (newdecl, olddecl)
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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5d1d581..e982c92 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4642,7 +4642,10 @@ tsubst (t, args, in_decl)
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);
@@ -5728,11 +5731,11 @@ instantiate_template (tmpl, targ_ptr)
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)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 87a64a3..2a5ad2b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1412,7 +1412,7 @@ ovl_member (fn, ovl)
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;
}