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] New: inherited polymorphic template class


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


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