BUG with template instantiation
Alexandre Oliva
oliva@dcc.unicamp.br
Sat Apr 4 18:08:00 GMT 1998
Philippe Lavoie writes:
> It seems egcs has problem with friend templates. The use of
> -fguiding-decls is odd, but at least things compile up to the
> following point.
-fguiding-decls breaks iostreams. Write correct ANSI/ISO C++, by
adding the following declarations:
template <class T> class Fred;
template <class T> friend ostream& operator<<(ostream&, const Fred<T>&);
template <class T> friend istream& operator>>(istream&, Fred<T>&);
Then, add `<>' when you refer to these template functions in friend
declarations.
> template<class T> class Fred
> {
> private:
> T i;
>// friend ostream& operator<<( ostream& os, const Fred<T>& x );
>// friend istream& operator>>( istream& is, Fred<T>& x );
> friend ostream& operator<< <>( ostream& os, const Fred<T>& x );
> friend istream& operator>> <>( istream& is, Fred<T>& x );
> };
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list