Help me ,nested template!!!!!!!!!!!!!!!

lau freeman laufreeman@hotmail.com
Fri Apr 14 06:09: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) ; };
 
Then I want to define another class:
 
typedef class Poly<double,double>  
sPoly;
 
class biPoly : public Poly<sPoly,double> {
 
        
.         
.         
.         . }
 
I used g++2.952 , after compiling, a error appeared like 
this:                 
In instantiation of 
`Polynomial<double,double>': bipoly.h:5:   instantiated from 
here poly.h:97: invalid use of undefined type `class 
Poly<double,double>' poly.h:22: forward declaration of `class 
Poly<double,double>' poly.h:97: confused by earlier errors, bailing 
out then I defined template class Poly<double,double>;
 
but a error like this appeared : invalid use of 
undefined type :Poly<Poly<double,double>,double> 
 
but I used g++2.905 and succeeded,what should I 
do?
 
 
 



More information about the Gcc-bugs mailing list