[gnu.g++.bug] inherited public overloaded method bug

vaughan%cadillac.cad.mcc.com@mcc.com (Paul Vaughan) (11/28/89)

The following file produces the error message shown below
-------------------
class A {
public:
  void foo(int);
};

void A::foo(int) {} // line 6

class B : public A {};
class C : public B {};

class D : public C {
public:
  void foo();
};

void D::foo() {
  foo(4);          // line 17
}


main() {
  D d;
}


[1.357]puma) g++ -v -g -O -DX11  -o privbug privbug.cc -lg++ -llwp -lX11 -lm 
gcc version 1.36.1 (based on GCC 1.36)
 /usr/local/gnu/1.36/lib/gcc-cpp -+ -v -DX11 -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 privbug.cc /usr/tmp/cca03024.cpp
GNU CPP version 1.36
 /usr/local/gnu/1.36/lib/gcc-cc1plus /usr/tmp/cca03024.cpp -quiet -dumpbase privbug.cc -g -O -version -o /usr/tmp/cca03024.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
privbug.cc: In method void D::foo ():
privbug.cc:6: the method void A::foo (int) is private
privbug.cc:17: within this context

Looks like a bug to me.  I tried various things, not too carefully.
It doesn't happen if D inherits directly from A.  I can work around it
by specifying A::foo(4) explicitly.  It seems like it is getting
confused about protected and public methods.