🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

more serious bug: inaccessible indirect public member

#1952
From: David Eppstein
Date: Sat, 06 May 1989 20:40
22 lines
1387 bytes
If one class is derived (not publically) from a second class, the
derived class can still use the parent's public members.

But if the parent class is itself derived (publically), g++ screws up:
it disallows access to the grandparent's public members, which should
have been inherited from the parent.

    ------------ code illustrating the bug ------------
class a { public: int foo(); };
class b : public a { public: int baz(); };
class c : b { int bar() { return foo() + baz(); }; };

    ------------ g++ output when run on sample ------------
g++ version 1.32.0
 /usr/local/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dvax -Dunix test.c /tmp/cc026645.cpp
GNU CPP version 1.33
 /usr/local/gnu/lib/gcc-c++ /tmp/cc026645.cpp -quiet -dumpbase test.c -version -o /tmp/cc026645.s
GNU C++ version 1.32.0 (vax) compiled by GNU C version 1.33.
In function c::bar ():
test.c:1: method int a::foo () is private
-- 
David Eppstein  eppstein@garfield.cs.columbia.edu  Columbia U. Computer Science
Technical Details
Message-ID: <6312@columbia.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!columbia!garfield!eppstein

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!columbia!garfield!eppstein
From: eppstein@garfield (David Eppstein)
Newsgroups: gnu.g++.bug
Subject: more serious bug: inaccessible indirect public member
Message-ID: <6312@columbia.edu>
Date: 6 May 89 20:40:17 GMT
Sender: news@columbia.edu
Organization: Columbia University CS Department
Lines: 22