Gcc template problems
lglastre
l_glastre@yahoo.de
Tue Jan 15 04:45:00 GMT 2002
subscribe
___________________________________
Hello,
I've some probleme with my gcc since the 2.96 version with operator
template.
You could find down here the listing a the result of the compilation
which
give me problem.
N.B : the souce get gut with the other compilers I use :
Egcs.1.1.2 (linux) Hp compiler(hpux) and whatcom compiler (Qnx)
Could you help me ?
Thank's in advance
L.Glastre
======================================================
//-------------- test bug template gcc 2.96 - 3.01 ------------------
template < class T> class foo;
template < class T> foo <T> operator - ( foo <T> f1, foo <T> f2 );
template < class T> class foo {
public :
friend foo <T> operator - <> ( foo <T> f1, foo <T> f2);
foo <T> operator - (void);
};
template <class T>
foo <T> operator - (foo <T> f1, foo <T> f2)
{
foo<T> f;
return(f);
}
template <class T>
foo <T> foo<T>::operator - (void)
{
foo<T> f;
return(f);
}
main()
{
foo <int> f1;
foo <int> f2;
f1 = f1 - f2;
return (0);
}
//-------------------------------------------------------------------------
// resultat de la compilation result :
// /opt/experimental/bin/g++
--version
3.0.1
// 3.0.1
//-------------------------------------------------------------------------
$/opt/experimental/bin/g++ ~/TestTemplate.cpp
/home/lg/TestTemplate.cpp:8: declaration of `foo<T> foo<T>::operator-()'
/home/lg/TestTemplate.cpp:3: changes meaning of `operator-' from `foo<T>
operator-(foo<T>, foo<T>)'
==================================================================================
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
More information about the Gcc-help
mailing list