From 62e3e13ab38d0d8fec813ebaeafb567afd9129c5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 1 Jul 2009 23:50:57 -0400 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/pt.c | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7aa9024e727f..6e79df9589c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2009-07-01 Jason Merrill + + * 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 * g++spec.c (lang_specific_driver): Bump num_args by 1. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b7c309d16235..125b80e4b971 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1312,6 +1312,8 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) return fn; } } + else if (fn) + return duplicate_decls (spec, fn, is_friend); /* A specialization must be declared in the same namespace as the template it is specializing. */ @@ -1701,12 +1703,13 @@ determine_specialization (tree template_id, if (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) return fn; /* It was a specialization of an ordinary member function in a template class. */ - *targs_out = copy_node (DECL_TI_ARGS (fn)); return DECL_TI_TEMPLATE (fn); } @@ -2237,7 +2240,8 @@ check_explicit_specialization (tree declarator, parm = TREE_CHAIN (parm)) DECL_CONTEXT (parm) = result; } - return tmpl; + return register_specialization (tmpl, gen_tmpl, targs, + is_friend); } /* Set up the DECL_TEMPLATE_INFO for DECL. */ -- 2.43.5