🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Paul Vaughan Mon, 27 Nov 1989 20:57
inherited public overloaded method bug
#623
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads