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
This commit is contained in:
Alexandre Oliva 2004-12-23 16:12:57 +00:00 committed by Alexandre Oliva
parent faa003343e
commit 08167d1cdb
4 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-12-23 Alexandre Oliva <aoliva@redhat.com>
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 <giovannibajo@gcc.gnu.org>
PR c++/18733

View File

@ -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;
}

View File

@ -1,3 +1,7 @@
2004-12-23 Alexandre Oliva <aoliva@redhat.com>
* g++.dg/template/spec19.C: New.
2004-12-23 Alexandre Oliva <aoliva@redhat.com>
PR target/16891

View File

@ -0,0 +1,23 @@
// PR c++/18962
template<class T1,int N1>
class Class
{
public:
template <class T2,int N2>
void function( const Class<T2,N2>& );
};
template<>
template<class T2,int N2>
void Class<int,1>::function( const Class<T2,N2>& param )
{
param; // make sure we use the argument list from the definition.
}
int main()
{
Class<int,1> instance;
Class<char,2> param;
instance.function( param );
}