* Template specialization problem
@ 2001-05-08 0:57 Ryszard Kabatek
0 siblings, 0 replies; only message in thread
From: Ryszard Kabatek @ 2001-05-08 0:57 UTC (permalink / raw)
To: gcc
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-08 0:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-08 0:57 Template specialization problem Ryszard Kabatek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).