When i'm trying to compile the following Code:
template <typename T> class X
{
private:
typedef void (X::*PtrToMethod)();
PtrToMethod method;
template <typename U> void some_func()
{
return;
}
public:
void func()
{
method = &X<T>::some_func<int>;
}
};
int main()
{
X<short> obj;
obj.func();
}
gcc rejects it with the expressionless errors:
error.cpp:15: error: expected primary-expression before 'int'
error.cpp:15: error: expected `;' before 'int'
(line 15 is method = &X<T>::some_func<int>;)
I'm sure, this code is correct, because gcc compiles it without
problems, if X is not a template-class, but a standard-c++-class.
Also, Comeau Online also compiles both variants (template and
non-template version of X)
I tried gcc 4.1.2 and gcc 4.3.0(20071012)
René