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]

Problems with gcc 2.95.3


Hi,

I encountered a problem in the gcc 2.95.3 (version 2.95.3, 20010315 
(release)) under Red-Hat-Linux 7.1. 

The following code does not compile unless I replace 'get(x)' in 'int 
B::get(int&, const int) const' to 'A::get(x)' what I don't want to do as 
there might be classes inbetween overwriting the get(x)-call. As B is derived 
from A, there should (?!) be no problem without using the A:: for the 
get(x)-call.

The error-message is as follows:
class.cxx: In method `int B::get(int &, int) const':
class.cxx:17: no matching function for call to `B::get (int &) const'
class.cxx:16: candidates are: int B::get(int &, int) const

Any suggestions which compiler to use instead? Using 2.96 is out of the 
question, as I get my programs compiled but not executed as intended.

Chris

------------------------------------------------

class A {
 public:
  void get ( int& x ) const;
  virtual int get ( int& x, const int l ) const = 0;
};

class B : public A {
 public:
  int get ( int& x, const int l ) const;
};

void A::get ( int& x ) const {
  x = 1;
}

int B::get ( int& x, const int l ) const {
  get (x);
  x = 2;
  return 5;
}

int main () {
  B b;

  int	x, l;

  b.get ( x, l );

}


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