something wrong with template instantiation mechanics

Oleg Krivosheev kriol@fnal.gov
Fri Oct 10 08:51:00 GMT 1997


Hi,

On Thu, 9 Oct 1997, Joe Buck wrote:

> > i've tried my code and lloks like tons of
> > small inline template functions are not
> > instantiated.
> 
> I think that this is a consequence of the new rules: you have both
> non-template and template abs functions.  Unfortunately, I'm confused
> by the new rules and not sure what is really supposed to change; I
> also think that there still may be some bugs in the code that implements
> them.

sorry, i sent a bit misleading example - maybe you're right,
i'm reading CD2 now.

Still i believe there are bugs in template instantiation -
if you change superdummy in the atached test.ii to

void
superdummy( void ) {
  TVector3D<double> ccc, ddd;
  ccc = 1.0;
  abs(ccc);
  ccc = ccc + ddd;
}


egcs will not be able instantiate 
op+( const  TVector3D<double>&, const  TVector3D<double>&  ) !

drabble ~ $ nm -s test.o | c++filt | grep Vec
00000000 W TVector3D<double>::~TVector3D(void)
00000000 W TVector3D<double>::operator=(TVector3D<double> const &)
00000000 W TVector3D<double>::operator=(double)
         U operator+(TVector3D<double> const &, TVector3D<double> const &)
00000000 W TVector3D<double>::TVector3D(void)
         U abs(TVector3D<double> const &)


there is  no template/nontemplate op+ ix in the code.

Can you verify this one?

thanks

OK




More information about the Gcc mailing list