K
ken
the test code is :
/////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
class CA
{
public:
template <typename T>
T Fun()
{
return T();
}
};
template<>
void CA::Fun<void>()
{
printf("in void\n");
return;
}
template <typename T>
class CB
{
public:
int operator()(T a1=T())
{
printf("aaa\n");
CA a;
a.Fun<T>(); //error this line
return 0;
}
};
int main()
{
CB<int> b;
b();
return 0;
}
/////////////////////////////////////////////////////////////////
the gcc 3.2.2 compiler report a error:
testtemp.cpp: In member function `int CB<T>:perator()(T)':
testtemp.cpp:37: parse error before `;' token
what's the matter? everything is right in the vc.net 7.1?
/////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
class CA
{
public:
template <typename T>
T Fun()
{
return T();
}
};
template<>
void CA::Fun<void>()
{
printf("in void\n");
return;
}
template <typename T>
class CB
{
public:
int operator()(T a1=T())
{
printf("aaa\n");
CA a;
a.Fun<T>(); //error this line
return 0;
}
};
int main()
{
CB<int> b;
b();
return 0;
}
/////////////////////////////////////////////////////////////////
the gcc 3.2.2 compiler report a error:
testtemp.cpp: In member function `int CB<T>:perator()(T)':
testtemp.cpp:37: parse error before `;' token
what's the matter? everything is right in the vc.net 7.1?