Here's a stripped-down example of the problem:
Code:
template < typename Type >
struct foo
{
template < typename Other >
Other bar( void ) const
{
return Other( );
}
};
template < typename Type >
void baz( foo< Type > const& object )
{
object.bar< int >( );
}
int main( void )
{
baz( foo< double >( ) );
}
The compiler complains: "expected primary-expression before 'int'" and "expected ';' before 'int'".
Incidentally, with a typedef the problem goes away:
Code:
template < typename Type >
struct foo
{
template < typename Other >
Other bar( void ) const
{
return Other( );
}
};
typedef foo< double >
foo_double;
void baz( foo_double const& object )
{
object.bar< int >( );
}
int main( void )
{
baz( foo_double( ) );
}
Unfortunately, I can't use the typedef approach here - I just thought I'd point it out.
Any ideas?
EDIT:
I'm using gcc 4.4.0 mingw.