home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.g++.bug
- Path: 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
-
- 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
-
-
-
-
-
-
-