After much ado, I finally tracked down the exact cause of the problem with my library... Here's the example code of what I'm trying to do:
class A
{
public:
template < typename T > static void function( void ) {}
};
template < typename T , typename FunctionT > class B
{
public:
void call_functon( void ) {
FunctionT::function<T>(); //ERROR: syntax error before `;' token
}
};
With or without instantiation, I get that error, and it has no helpful hints. The problem seems to occur because I'm trying to call a templatized function of a template argument (the problem disappears when I make A::function a non template and remove the template argument on the error-inducing line.
For my library I solved the problem by making the entirety of class A templatized, and removing the templatization of function() within that class, aka like so:
template < typename T > class A
{
public:
static void function( void ) {}
};
template < typename T , typename FunctionT > class B
{
public:
void call_functon( void ) {
FunctionT::function<T>(); //ERROR: syntax error before `;' token
}
};
int main ( int argc , char ** argv )
{
//old version: B<int,A> b;
//new version:
B<int,A<int>> b;
b.call_function();
}
which although a bit uglier is acceptable for my situation (since B's 2nd parameter has a usually used default 2nd parameter anyways) but I'm wondering what the workaround is for a case where I NEED the members of (the equivilant of) class A to be templatized.
edit: also, compiling this with GCC 3.3.1 on cygwin/win2k