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: 971031 and 971105: friendly template functions are not instantiated


Kevin Buhr writes:

> t"-fguiding-decls" makes the problem disappear, so perhaps I was
> relying on an obsolete language feature for my particular test case.

That's right.

> If I understand correctly, the default "-fno-guiding-decls" 
[snip]
> *should* instantiate [a templated "f"] here:

>      template <class T>
>      void f(foo<T> x) {};

>      template <class T>
>      class foo {
> 	     friend void f(foo x);  // hey! this should be 
> 				    // the template version!
>      };

Not at all.  I could have declared:

void f(foo<int> x) { /*...*/ }

And this is not a template function.  If you wish to refer to a
template version of a function, you *must* use angle brackets, unless
-fguiding-decls is issued.

-- 
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]