This is the mail archive of the gcc@gcc.gnu.org mailing 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]

Re: 3.4.3 C++ parsing bug?


On Fri, Feb 11, 2005 at 01:53:23PM -0800, Jan Reimers wrote:
> Can someone verify that this is valid C++ before I submit a bug report:
> 
> // test.C
> template <class T> class A {static T* c;};
> 
> class B : public A<B> {};
> 
> B* A<B>::c=0;
> // end test.C

It's not valid (though a number of compilers have accepted it in the
past); for template specializations you need template<>, and your
definition of A<B>::c is a specialization.

Instead write

template<>
B* A<B>::c = 0;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]