P
pce
Hello,
we are having problems when trying to compile a template code using
GNU G++ compiler, however it compiles properly using Microsoft C++
compiler.
Given the following declaration
class foo
{
};
template< class T >
class myclass {
public:
static myclass *s_centl;
};
myclass<int> obj1; // OK in MS C++ and GNU
myclass<foo> obj2; // OK in MS C++ and GNU
template<int> myclass<int>* myclass<int>::s_centl = new
myclass<int>() ; // OK in MS C++ and GNU
template<foo> myclass<foo>* myclass<foo>::s_centl = new
myclass<foo>() ;// OK in MS C++ but fails in GNU
the last statement produces the following error when using GNU C++
compiler:
"error 'class foo" is not a valid type for a template constant
parameter"
what I have to do to define properly this static member in GNU ?
Many thanks in advance
Pedro
pce1962
we are having problems when trying to compile a template code using
GNU G++ compiler, however it compiles properly using Microsoft C++
compiler.
Given the following declaration
class foo
{
};
template< class T >
class myclass {
public:
static myclass *s_centl;
};
myclass<int> obj1; // OK in MS C++ and GNU
myclass<foo> obj2; // OK in MS C++ and GNU
template<int> myclass<int>* myclass<int>::s_centl = new
myclass<int>() ; // OK in MS C++ and GNU
template<foo> myclass<foo>* myclass<foo>::s_centl = new
myclass<foo>() ;// OK in MS C++ but fails in GNU
the last statement produces the following error when using GNU C++
compiler:
"error 'class foo" is not a valid type for a template constant
parameter"
what I have to do to define properly this static member in GNU ?
Many thanks in advance
Pedro
pce1962