diff options
author | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-15 01:11:38 +0000 |
---|---|---|
committer | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-15 01:11:38 +0000 |
commit | 08bea2b875c7b1dfffe915088d4f6a26d78ce175 (patch) | |
tree | f98f68098b30f27326cc180033a42815d24ad090 /gcc/cp | |
parent | c5de8ae19bbf59bf82ac30f10048da5e9ee9959b (diff) | |
download | gcc-08bea2b875c7b1dfffe915088d4f6a26d78ce175.tar.gz |
* pt.c (check_explicit_specialization): Propagate default
function arguments to explicit specializations.
* g++.old-deja/g++.pt/spec33.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38266 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 25 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9c3fd361840..07753bf4149 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + * pt.c (check_explicit_specialization): Propagate default + function arguments to explicit specializations. + 2000-12-13 DJ Delorie <dj@redhat.com> * typeck.c (build_binary_op): Do signed/unsigned warnings for >? diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a4463ebe48b..34540a84b33 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1543,6 +1543,31 @@ check_explicit_specialization (declarator, decl, template_count, flags) last_function_parms = TREE_CHAIN (last_function_parms); } + /* Inherit default function arguments from the template + DECL is specializing. */ + { + tree t1 = TYPE_ARG_TYPES (TREE_TYPE (decl)); + tree t2 = TYPE_ARG_TYPES (TREE_TYPE (DECL_TEMPLATE_RESULT (tmpl))); + + /* DECL may contain more parameters than TMPL due to the extra + in-charge parameter in constructors and destructors. */ + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2); + if (DECL_HAS_IN_CHARGE_PARM_P (decl)) + t1 = TREE_CHAIN (t1); + + /* Note that we do not need to reparse default arguments, + since explicit specialization cannot be declared in + class scope as in [temp.expl.spec]. */ + for (; t1 && t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2)) + { + if (TREE_PURPOSE (t2)) + TREE_PURPOSE (t1) = TREE_PURPOSE (t2); + } + + my_friendly_assert (t1 == NULL_TREE && t2 == NULL_TREE, 20001211); + } + /* Set up the DECL_TEMPLATE_INFO for DECL. */ DECL_TEMPLATE_INFO (decl) = tree_cons (tmpl, targs, NULL_TREE); |