pt.c (register_specialization): Use duplicate_decls to merge the argument with a previous specialization.

* pt.c (register_specialization): Use duplicate_decls to merge
	the argument with a previous specialization.
	(check_explicit_specialization): Call register_specialization to
	merge the TEMPLATE_DECL with a previous version.
	(determine_specialization): Return the args even if fn is a template.

From-SVN: r149165
This commit is contained in:
Jason Merrill 2009-07-01 23:50:57 -04:00 committed by Jason Merrill
parent f2082f9028
commit 62e3e13ab3
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2009-07-01 Jason Merrill <jason@redhat.com>
* pt.c (register_specialization): Use duplicate_decls to merge
the argument with a previous specialization.
(check_explicit_specialization): Call register_specialization to
merge the TEMPLATE_DECL with a previous version.
(determine_specialization): Return the args even if fn is a template.
2009-07-01 Ian Lance Taylor <iant@google.com> 2009-07-01 Ian Lance Taylor <iant@google.com>
* g++spec.c (lang_specific_driver): Bump num_args by 1. * g++spec.c (lang_specific_driver): Bump num_args by 1.

View File

@ -1312,6 +1312,8 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
return fn; return fn;
} }
} }
else if (fn)
return duplicate_decls (spec, fn, is_friend);
/* A specialization must be declared in the same namespace as the /* A specialization must be declared in the same namespace as the
template it is specializing. */ template it is specializing. */
@ -1701,12 +1703,13 @@ determine_specialization (tree template_id,
if (candidates) if (candidates)
{ {
tree fn = TREE_VALUE (candidates); tree fn = TREE_VALUE (candidates);
/* DECL is a re-declaration of a template function. */ *targs_out = copy_node (DECL_TI_ARGS (fn));
/* DECL is a re-declaration or partial instantiation of a template
function. */
if (TREE_CODE (fn) == TEMPLATE_DECL) if (TREE_CODE (fn) == TEMPLATE_DECL)
return fn; return fn;
/* It was a specialization of an ordinary member function in a /* It was a specialization of an ordinary member function in a
template class. */ template class. */
*targs_out = copy_node (DECL_TI_ARGS (fn));
return DECL_TI_TEMPLATE (fn); return DECL_TI_TEMPLATE (fn);
} }
@ -2237,7 +2240,8 @@ check_explicit_specialization (tree declarator,
parm = TREE_CHAIN (parm)) parm = TREE_CHAIN (parm))
DECL_CONTEXT (parm) = result; DECL_CONTEXT (parm) = result;
} }
return tmpl; return register_specialization (tmpl, gen_tmpl, targs,
is_friend);
} }
/* Set up the DECL_TEMPLATE_INFO for DECL. */ /* Set up the DECL_TEMPLATE_INFO for DECL. */