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: Help me ,nested template!!!!!!!!!!!!!!!


> I defined a template class Poly in poly.h
> template <class T,class S>
> class Poly{
>         .
>         .
>         .
>         .
> //and a friend function
> 
> friend Poly<T,S>  operator* <>(const T &c,const Poly<T,S> &pl) ;
> };

I guess you also have an operator* in that function. In standard C++,
you should now write

 friend Poly<T,S>  ::operator* <>(const T &c,const Poly<T,S> &pl) ;

because operator* probably refers to the other operator* in the class,
not to the global function.

> but I used g++2.905 and succeeded,what should I do?

A number of things. First, please try to get familiar with the bug
reporting instructions, as summarized in

http://www.gnu.org/software/gcc/bugs.html

Also, have a look at the section "Reporting Bugs". If you really want
to report a bug, you must include all details.

If you want to get your code working, I recommend removing the friend
declaration, and arranging the members that this operator needs to
access to be public members. Alternatively, you could also introduce a
helper friend function which is not called operator*.

Regards,
Martin


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