|
|
Back to UserFriendly Strip Comments Index
|
Attn: C++ gurus | by nix | 2003-10-22 13:35:28 |
|
How was blech declared? | by ToLazyToThink | 2003-10-22 14:35:26 |
| here's some exact code that has the same issue |
by nix |
2003-10-22 15:56:53 |
#include <iostream>
#include <typeinfo>
using namespace std;
template <class TYPE>
class blah
{
TYPE feh;
public:
void blech(int x);
template <class T> void gak(int x);
template <class T> void eck(int x);
void ugh(int x);
};
template <class TYPE> template <class T> void blah<TYPE>::gak(int x)
{
T a;
cout << typeid(a).name() << endl;
}
template <> template <class T> void blah<int>::eck(int x)
{
T a;
cout << typeid(a).name() << endl;
}
template <class TYPE> void blah<TYPE>::blech(int x)
{
cout << typeid(feh).name() << endl;
}
template <> void blah<int>::ugh(int x)
{
cout << typeid(feh).name() << endl;
}
template <class T>
void foobar(int x)
{
T a;
cout << typeid(a).name() << endl;
}
int main()
{
return 0;
}
This compiles and works properly when I comment out the declaration and definition of the method 'eck'. With "eck" in there, g++ fails with
ttest.cpp:23: template-id `eck<>' for `void blah<int>::eck(int)'
does not match any template declaration
ttest.cpp:23: syntax error before `{' token
ttest.cpp:25: syntax error before `<<' token
Note that 'gak' (a template function in a template class) works, as does 'ugh" (a normal function in a specialized template class); it's only 'eck', a template function in a specialized template class, that fails |
|
[ Reply ] |
|
BTW, the compiler was GCC 3.2.2 20030222 | by nix | 2003-10-22 16:16:37 |
|
Ok, I think I got it | by sereth | 2003-10-22 17:29:03 |
|
|
[Todays Cartoon Discussion]
[News Index]
|
|