Possible bug in explicit template specialization

Nathan Sidwell nathan@codesourcery.com
Tue Jun 6 06:02:00 GMT 2000


Roman Levenstein wrote:


> // #1 <- error message
> A<int>& A<int>::assign(int const & obj)
> {
>   // code of assign
> }
> 
> Compiler gives the following error messages:
> 
> templ.cpp:24: specialization of A<int>::assign(const int &) after
> instantiation
> templ.cpp:24: explicit specialization of A<int>::assign(const int &)
> after first use
you need to _declare_ the specialization, before you use it. I.e

	A<int> &A<int>::assign (int const &obj);
before the body of dummy_func.

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


More information about the Gcc-bugs mailing list