From 08167d1cdbfaf763a8bede8fd46c870356a921f5 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 23 Dec 2004 16:12:57 +0000 Subject: [PATCH] re PR c++/18962 (specialization of template class with inner template members and parameter) gcc/cp/ChangeLog: PR c++/18962 * pt.c (check_explicit_specialization): Use the argument list from the definition in a template function specialization definition. gcc/testsuite/ChangeLog: * g++.dg/template/spec19.C: New. From-SVN: r92552 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/template/spec19.C | 23 +++++++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/spec19.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2d6e1af0133..c8e448f4e2b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-12-23 Alexandre Oliva + + PR c++/18962 + * pt.c (check_explicit_specialization): Use the argument list from + the definition in a template function specialization definition. + 2004-12-23 Giovanni Bajo PR c++/18733 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 07cdd5d7356..3c6f5bcbbdf 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2059,6 +2059,10 @@ check_explicit_specialization (tree declarator, DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl); DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl)) = DECL_SOURCE_LOCATION (decl); + /* We want to use the argument list specified in the + definition, not in the original declaration. */ + DECL_ARGUMENTS (DECL_TEMPLATE_RESULT (tmpl)) + = DECL_ARGUMENTS (decl); } return tmpl; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45620fdd561..3a91de1d365 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-12-23 Alexandre Oliva + + * g++.dg/template/spec19.C: New. + 2004-12-23 Alexandre Oliva PR target/16891 diff --git a/gcc/testsuite/g++.dg/template/spec19.C b/gcc/testsuite/g++.dg/template/spec19.C new file mode 100644 index 00000000000..c560b01642a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec19.C @@ -0,0 +1,23 @@ +// PR c++/18962 + +template +class Class +{ +public: + template + void function( const Class& ); +}; + +template<> +template +void Class::function( const Class& param ) +{ + param; // make sure we use the argument list from the definition. +} + +int main() +{ + Class instance; + Class param; + instance.function( param ); +} -- 2.30.2