[bug] Template friends, namespace and instantiation
Lavoie Philippe
lavoie@zeus.genie.uottawa.ca
Wed Dec 9 12:49:00 GMT 1998
Alexandre Oliva writes:
>
> 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.
>
You mean with something like
extern template void resizeG(Vector<Point<float,3> >& , int );
is that what you mean by having the explicit instantiation in the
header?
By the way, if I remove the namespace and just use
template<> void resizeG(Vector<Point<float,3> >& , int ){ cout <<
"B";}
It works with no problem (output of program is B and not A).
However, it behaves as I described with the namespace. Why is the
namespace creating problems ?
Thanks for the reply.
Phil
More information about the Gcc-bugs
mailing list