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

fmaerten at igeoss dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 16 15:08:00 GMT 2005


Hi all,

  We just found a bug while compiling the following code. The derived template
class doens't know the pure virtual method from its parent class when this
template class has a method with the same name, but with different arguments:

class A {
public:
  virtual void doit() = 0 ;
} ;

template <typename T>
class B: public A {
public:
  virtual void doit(double) {}
} ;

class C: public B<double> {
public:
  virtual void doit() {}
} ;


int main() {
  A*         a = new C ;
  B<double>* b = new C ;
  a->doit() ; // ok

  // Compile error with gcc-3.4.3:
  //   error: no matching function for call to `B<double>::doit()'
  //   note: candidates are: void B<T>::doit(double) [with T = double]
  b->doit() ;
}


-- 
           Summary: inherited polymorphic template class
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fmaerten at igeoss dot com


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



More information about the Gcc-bugs mailing list