🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Bug in accessing protected member

#1325
From: Mike Stump
Date: Tue, 05 Jan 1993 09:48
54 lines
1940 bytes
This problem has been fixed, and should not exist in gcc 2.3.2 and on.

Thanks for the report.

> Posted-Date: Mon, 15 Jun 92 13:12:32 PDT
> Message-Id: <199206152012.AA07127@aerospace.aero.org>
> From: gorlick@aero.org
> To: bug-gcc@prep.ai.mit.edu
> Date: Mon, 15 Jun 92 13:12:32 PDT

> The compiler produces an error message when a derived class tries to  
> assign to a protected member of a base class using a qualified name.

> /* Start of example */
> class A
> {
>  public:
>   A() {}
>   ~A() {}

>  protected:
>   int a;
> };

> class B : public A
> {
>  public:
>   B() {}
>   ~B() {}
>   void foo(int);
> };

> void
> B::foo(int i)
> {
>  A::a = i; /* Error message issued for this assignment. */
> }
> /* End of example */

> The compiler output is:
> gcc -v -c /tmp/foo.cc
> gcc version 2.2.1
>  /usr/aero/xlib/gcc-lib/next/2.2.1/cpp -lang-c++ -v -undef  
> -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dmc68000 -Dm68k -DNeXT  
> -Dunix -D__MACH__ -D__mc68000__ -D__m68k__ -D__NeXT__ -D__unix__  
> -D__MACH__ -D__mc68000 -D__m68k -D__NeXT -D__unix -D__MACH__  
> /tmp/foo.cc /usr/tmp/cc002635.i
> GNU CPP version 2.2.1 (68k, MIT syntax)
>  /usr/aero/xlib/gcc-lib/next/2.2.1/cc1plus /usr/tmp/cc002635.i -quiet  
> -dumpbase foo.cc -version -o /usr/tmp/cc002635.s
> GNU C++ version 2.2.1 (68k, MIT syntax) compiled by GNU C version  
> 2.2.1.
> /tmp/foo.cc: In method `void  B::foo (int)':
> /tmp/foo.cc:22: invalid lvalue in unary `&'
Technical Details
Message-ID: <9301050948.AA12423@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Subject: Re:  Bug in accessing protected member
Message-ID: <9301050948.AA12423@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 5 Jan 1993 09:48:05 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 55