Jonathan Wakely - Re: specific instantiation of static members from template class (original) (raw)
This is the mail archive of the gcc@gcc.gnu.orgmailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] |
- From: Jonathan Wakely
- To: cedric
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 17 Nov 2005 20:37:41 +0000
- Subject: Re: specific instantiation of static members from template class
- References: <200511171645.44172.cedric.borgese@gmail.com>
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 #include "Test.h"
int main(int argc, char **argv) { std::cout << TestInt::member << std::endl; return 0; }
///// test.h template class Test { public:
static T member;};
add this line here: template T Test::member;
typedef Test TestInt;
///// test.cpp #include "Test.h"
template class Test;
Either remove this line or place it before the explicit instantiation:
template<> int Test::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.
- References:
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |