This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Template specialization problem
- To: gcc at gcc dot gnu dot org
- Subject: Template specialization problem
- From: Ryszard Kabatek <Ryszard dot Kabatek at softax dot pl>
- Date: Tue, 08 May 2001 09:55:06 +0200
- Reply-To: Ryszard dot Kabatek at softax dot pl
In the sample below I get the folowing error message:
spec.cc:30: template-id `toType<>' for `char X<char>::toType(int)' does
not
match any template declaration
spec.cc:30: syntax error before `{' token
Is it a compiler bug or I misunterstod something?
Regards
--
Ryszard Kabatek
template<typename T>
struct X {
typedef T type;
typedef T itype;
static type toType(itype i);
static itype toItype(type c) {return static_cast<itype>(c);}
};
template<>
struct X<char> {
typedef char type;
typedef int itype;
static type toType(itype i);
static itype toItype(type c) {return static_cast<itype>(c);}
};
template<typename T>
X<T>::type
X<T>::toType(itype i)
{
return static_cast<type>(i);
}
template<>
X<char>::type
X<char>::toType(itype i)
{
return static_cast<type>(i);
}