cedric wrote:
>
> hello, I have a problem when I try to instantiate static members. this code
> works with gcc-3.4.5 but not with gcc-4.0.2 (debian sid).
> here a test case with 3 files :
>
>
> ///// main.cpp
> #include <iostream>
> #include "Test.h"
>
> int main(int argc, char **argv)
> {
> std::cout << TestInt::member << std::endl;
> return 0;
> }
>
> ///// test.h
> template <class T>
> class Test
> {
> public:
>
> static T member;
> };
add this line here:
template <class T> T Test<T>::member;
> typedef Test<int> TestInt;
>
> ///// test.cpp
> #include "Test.h"
>
> template class Test<int>;
Either remove this line or place it before the explicit instantiation:
> template<> int Test<int>::member;
I think GCC is right here.
jon
--
"God is as real as I am," the old man said. My faith was restored, for
I knew that Santa would never lie.