Topic: templates and static data members


Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: Sat, 20 Aug 1994 15:13:31 GMT
Raw View
adopt@CAM.ORG (Richard Migneron) writes:

> Seems that gcc (2.5.8) does not accept static data
> members whithin templates.

Yes, that's correct.

>  foo.cxx:8: invalid template `int bar'
>  foo.cxx:8: end of file read inside definition

g++ 2.6.0 gives a slightly more informative error message:

 foo.cxx:8: sorry, not implemented: static data member templates
 foo.cxx:8: end of file read inside definition

>  To me , it sounds like a bug.

The distinction between a bug and an unimplemented feature is
a subtle one.  You could certainly call it a bug.

--
Fergus Henderson - fjh@munta.cs.mu.oz.au




Author: adopt@CAM.ORG (Richard Migneron)
Date: 10 Aug 1994 16:40:57 -0400
Raw View
Hi,

 Seems that gcc (2.5.8) does not accept static data
 members whithin templates.

 Consider the following code :

    template <class Type>
    class foo {
     public:
       static int bar;
    };

    template <class Type>
    int foo<Type>::bar = 10;

  gcc raises the error :

  foo.cxx:8: invalid template `int bar'
  foo.cxx:8: end of file read inside definition

  To me , it sounds like a bug.

  has anybody faced the problem ?