This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18950] New: specialization of template class with inner template members
- From: "boris at buf dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2004 09:42:33 -0000
- Subject: [Bug c++/18950] New: specialization of template class with inner template members
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code used to compile fine with gcc 3.3 (linux x86), but
doesn't anymore with gcc 3.4 (just as a hint, it seems to compile fine
with Comeau) :
template<class T1,int N1>
class Class
{
public:
template<class T2,int N2> T2 function( T2 param );
};
template<>
template<class T2,int N2>
T2 Class<int,1>::function( T2 param )
{ // line 11
return param * N2;
}
int main()
{
Class<int,1> instance;
return instance.function<char,4>( 12 );
}
This produces the following output:
test-gcc34.cpp:11: error: template-id `function<>' for `T2 Class<int,
1>::function(T2)' does not match any template declaration
test-gcc34.cpp:11: error: erreur de syntaxe before `{' token
It works if we add the specialized declaration of the class "Class":
template<>
class Class<int,1>
{
public:
template<class T2,int N2> T2 function( T2 param );
};
but this can be painful if "Class" contains a lot more members.
It also works if "function" is only templated by one argument :
template<>
template<class T2>
T2 Class<int,1>::function( T2 param )
{ // line 11
return param * 2;
}
Thanks.
--
Summary: specialization of template class with inner template
members
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: boris at buf dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18950