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]
Other format: [Raw text]

[Bug c++/24893] inherited polymorphic template class



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-16 15:17 -------
First this has nothing to do with templates, you can reproduce the error
message without templates.
Second this is how C++ works.
doit(double) in B<T> hides doit(void) in A as it is the same name.
The way to fix it would either to do:
  b->A::doit() ;
or:
Change defintion of B to include a using statement like:
template <typename T>
class B: public A {
public:
  virtual void doit(double) {}
  using A::doit;
} ;

This makes both doit visible in B<T>.  In fact you will have the same issue
trying to call doit(double) in C, you solve it the same way.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24893


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