[bug] Template friends, namespace and instantiation
Alexandre Oliva
oliva@dcc.unicamp.br
Wed Dec 9 12:49:00 GMT 1998
On Dec 8, 1998, Lavoie Philippe <lavoie@zeus.genie.uottawa.ca> wrote:
> I'll reduce the code to the problem area here
> namespace Test {
> template <class T> void resizeG(Vector<T>&, int ) { cout << "A" ;}
> template <>
> void resizeG(Vector<Point<float,3> >& , int ) { cout << "B" ; }
> }
> using namespace Test ;
> template void resizeG<Point<float,3> >(Vector<Point<float,3> >& , int ) ;
The actual problem is that you refer to the non-specialized version
within the declaration of class Vector, and only declare the
specialization after that. The explicit instantiation is correct, but
it will not affect the other translation unit unless it is at least
declared in the header file.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list