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]

No Subject


> egcs_bug.cc: In function `int main()':
> egcs_bug.cc:13: no matching function for call to `B<int>::a ()'
> egcs_bug.cc:8: candidates are: B<int>::a(int)

The compiler is right, your code is wrong. There is no B<int>::a(),
since A<int>::a() is shadowed by B<int>::a(int). One possible
correction is

template <class T> 
struct A {
  void a() {}
};

template <class T> 
struct B: public A<T> {
  void a( int ) {}
};

main()
{
  B<int>().A::a();
}

Regards,
Martin


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