Help me ,nested template!!!!!!!!!!!!!!!
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Wed Apr 19 14:53:00 GMT 2000
> 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
More information about the Gcc-bugs
mailing list