Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!ucla-cs!uci-ics!news From: schmidt@zola.ics.uci.edu (Doug Schmidt) Newsgroups: gnu.g++.bug Subject: Re: (none) Message-ID: <1989Oct4.043012.9130@paris.ics.uci.edu> Date: 4 Oct 89 04:30:12 GMT References: <8910040029.AA01293@flora.CCS.Northeastern.EDU> Sender: news@paris.ics.uci.edu (Network News) Reply-To: schmidt@zola.ics.uci.edu (Doug Schmidt) Distribution: gnu Organization: University of California, Irvine - Dept of ICS Lines: 37 In-reply-to: kenb@flora.ccs.northeastern.edu (kenneth baclawski) In article <8910040029.AA01293@flora.CCS.Northeastern.EDU>, kenb@flora (kenneth baclawski) writes: >/* > Problem with protected members in GNU C++ > >Compilation: >g++ -v -c protect.c >g++ version 1.35.1- > /kens-disk/k/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 protect.c /tmp/cca08429.cpp >GNU CPP version 1.35 > /kens-disk/k/gnu/lib/gcc-cc1plus /tmp/cca08429.cpp -quiet -dumpbase protect.c -noreg -version -o /tmp/cca08429.s >GNU C++ version 1.35.1- (68k, MIT syntax) compiled by GNU C version 1.35. >In method struct derived *derived::derived (struct base &): >protect.c:10: member `a' is a protected member of class `base' > >*/ > >class base { >protected: > int a; >}; > >class derived : public base { >public: > derived (base& y) { a = y.a; } >}; This is not a bug, it is a `feature.' Check out how C++ 2.0 does it and you should get the same complaint. See libg++ code for examples of how to `work-around' this `feature.' Or complain about it on comp.lang.c++ ;-) Doug -- schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente. office: (714) 856-4043 | Per me si va nell'eterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza o voi ch'entrate.