🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

g++ 2.2.2 ss-920925 bug: cannot call private method

#1007
From: Rainer Orth
Date: Fri, 02 Oct 1992 08:30
42 lines
1970 bytes
g++ 2.2.2 ss-920925 on a SPARCstation ELC running Solaris 2.0 failed to
compile two source files from groff 1.06 which used to work fine with the
2.2.2 distribution on SunOS 4.

The problem can be reduced to the following minimal test case:

----- privbug.ii -------------------------------------------------------------
class reference {
private:
  void contains_field() const;
public:
  void classify();
};
void reference::contains_field() const
{
}
void reference::classify()
{
  contains_field();
}
------------------------------------------------------------------------------

g++ produces the following error message:

ro@efeu 1275 > gcc -v -c privbug.ii
Reading specs from /vol/gnu/lib/gcc-lib/sparc-sun-solaris2.0/2.2.2/specs
gcc version 2.2.2
 /vol/gnu/lib/gcc-lib/sparc-sun-solaris2.0/2.2.2/cc1plus privbug.ii -quiet -version -o /tmp/cca0042A.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
privbug.ii: In method `void reference::classify ()':
privbug.ii:8: the method void reference::contains_field ()const  is private
privbug.ii:12: within this context

This seems to be wrong; it should always be possible for a public method to
call a private method.

Omitting the `const' specifier corrects the problem.

-----------------------------------------------------------------------------
Rainer Orth, Technical Computer Science, University of Bielefeld

Internet: ro@TechFak.Uni-Bielefeld.DE
Technical Details
Message-ID: <9210020630.AA02179@anemone.techfak.uni-bielefeld.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!techfak.uni-bielefeld.DE!ro

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!techfak.uni-bielefeld.DE!ro
From: ro@techfak.uni-bielefeld.DE (Rainer Orth)
Subject: g++ 2.2.2 ss-920925 bug: cannot call private method
Message-ID: <9210020630.AA02179@anemone.techfak.uni-bielefeld.de>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 2 Oct 1992 08:30:17 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 44