🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #623

inherited public overloaded method bug

#623
From: Paul Vaughan
Date: Mon, 27 Nov 1989 20:57
43 lines
1804 bytes
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.
Technical Details
Message-ID: <8911272057.AA03043@puma.cad.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!mcc.com!vaughan%cadillac.cad.mcc.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!mcc.com!vaughan%cadillac.cad.mcc.com
From: vaughan%cadillac.cad.mcc.com@mcc.com (Paul Vaughan)
Newsgroups: gnu.g++.bug
Subject: inherited public overloaded method bug
Message-ID: <8911272057.AA03043@puma.cad.mcc.com>
Date: 27 Nov 89 20:57:31 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 43