This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: DWP guiding decls with egcs-1.0.1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]