🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

friendly access to private base classes

#708
From: Tom Keffer
Date: Wed, 13 Dec 1989 01:55
31 lines
1293 bytes
There seems to be a difference in interpretation between cfront 2.0
and g++ in whether a friend function has access to a private base
class.  The following code compiles without protest with cfront 2.0,
but gives an error with g++ 1.36.1:

class Base {
};

class Derived : private Base {
friend void foo(Derived& d);
};

void func(Base&);

void foo(Derived& d){
  func(d);
}


Results:  
sperm[tmp]% g++ -c friend.cc
friend.cc: In function void foo (class Derived &):
friend.cc:11: type `Derived' is derived from private `Base'

-tk

---
 Dr. Thomas Keffer          | Internet: keffer@ocean.washington.edu
 Rogue Wave                 | BITNET:   keffer%ocean.washington.edu@UWAVM
 Seattle, WA 98145          | uucp:     uw-beaver!ocean.washington.edu!keffer
 (206) 523-5831             | Telemail: T.KEFFER/OMNET
Technical Details
Message-ID: <8912130155.AA29594@sperm.ocean.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!SPERM.OCEAN.WASHINGTON.EDU!keffer

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!SPERM.OCEAN.WASHINGTON.EDU!keffer
From: keffer@SPERM.OCEAN.WASHINGTON.EDU (Tom Keffer)
Newsgroups: gnu.g++.bug
Subject: friendly access to private base classes
Message-ID: <8912130155.AA29594@sperm.ocean.washington.edu>
Date: 13 Dec 89 01:55:50 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 31