Article View: gnu.g++.bug
Article #1222Scope operator bug.
From: Jarand Roeynstrand
Date: Fri, 20 Nov 1992 09:01
Date: Fri, 20 Nov 1992 09:01
51 lines
1425 bytes
1425 bytes
I usually use a cfront compiler, but suddenly i decided to run some code
through a g++ compiler as a portability test. I got the following problem:
Consider the code:
class a
{
public:
int x;
void SetX( int xi ) { x=xi; }
};
class b
{
public:
a y;
void SetY( a *y );
};
void b :: SetY( a *y )
{
#ifndef gcc
b :: y.SetX( y->x ); // This code does not compile under gcc. Line 20.
#else
this->y.SetX( y->x ); // This code compiles under both compilers.
#endif
}
The problem is, of course,that the parameter called y hides b's the member
object y, and that problem is resolved by the notation b::y, only that this
does not work on gcc.
gcc-2.3.1 complains:
testing.C: In method `void b::SetY (class a*)':
testing.C:20: object in '.' expression is not of aggregate type.
This seems to be a compiler bug.
--
Jarand Roeynstrand Phone: +47-7-597275 (EFI)
EFI +47-7-962355 (Home)
N-7034 Trondheim
Norway email: jr@efi.sintef.no
Technical Details
Message-ID:
<1992Nov20.090109.22968@ugle.unit.no>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!efi.sintef.NO!jrShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!efi.sintef.NO!jr From: jr@efi.sintef.NO (Jarand Roeynstrand) Subject: Scope operator bug. Message-ID: <1992Nov20.090109.22968@ugle.unit.no> Sender: gnulists@ai.mit.edu Organization: SINTEF EFI Distribution: gnu Date: Fri, 20 Nov 1992 09:01:09 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 52