This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: DWP guiding decls with egcs-1.0.1
- To: Miljenko Cvjetko <cvjetko_nospam at rt dot e-technik dot uni-erlangen dot de>
- Subject: Re: DWP guiding decls with egcs-1.0.1
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 11 Jan 1998 01:10:57 -0200
- Cc: egcs-bugs at cygnus dot com
- References: <34B7C361.5C53@rt.e-technik.uni-erlangen.de>
Miljenko Cvjetko writes:
> What are these guiding decls and how am I supposed to
> declare for example operator== or operator<< ???
Guiding declarations are deprecated template declarations that look
like non-template ones, just like the one you're trying to do. This
has been supported in previous versions of gcc, but it no longer is,
as it is non-standard and ambiguous.
> What does " add <> after the function name " mean???
It means that, in order to tell the compiler that the friend
declaration refers to a specialization of a template, you must add
angle brackets after the function name in that declaration.
> Further, playing with this example I came up with internal compiler
> error which might interest You.
This may be fixed in the next snapshot. The error occurs because you
have referred to a template that had not been declared yet. A valid
declaration of the function template must be provided in namespace
scope (not in the class scope) before the friend declaration:
template <class T> class X;
template <class T> bool operator==(const X<T>&, const X<T>&);
> template <class T>
> class X
> {
//...
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil