G
gogo1969
Hello,
I was wondering why the following code compiles with Intel C++ 8.0 and
MS VC++ 7.1 but not with gcc 4.0.1 and Comeau 4.3.3:
#include <iostream>
template < class T > struct B {
template < class O > static O CastTo( T t ) { return O( t ); }
};
template < class T > int convert( T t )
{
return B< T >::CastTo< int >( t );
// ^
// Comeau: Type not allowed
}
int main( int, char** )
{
std::cout << convert( 'c' );
return 0;
}
The problem is this line: 'B< T >::CastTo< int >( t );'
I was wondering why the following code compiles with Intel C++ 8.0 and
MS VC++ 7.1 but not with gcc 4.0.1 and Comeau 4.3.3:
#include <iostream>
template < class T > struct B {
template < class O > static O CastTo( T t ) { return O( t ); }
};
template < class T > int convert( T t )
{
return B< T >::CastTo< int >( t );
// ^
// Comeau: Type not allowed
}
int main( int, char** )
{
std::cout << convert( 'c' );
return 0;
}
The problem is this line: 'B< T >::CastTo< int >( t );'