Article View: gnu.g++.bug
Article #1128type cast of qualified const member breaks g++2.3.1
From: Robert R. Henry
Date: Tue, 10 Nov 1992 19:08
Date: Tue, 10 Nov 1992 19:08
34 lines
1185 bytes
1185 bytes
When the following program is compiled using g++2.3.1,
host=sparc, target=sparc, the construct
j = (int)Thing::N;
generates assembly code that references the global N (in a load);
sethi %hi(_N),%o0
ld [%o0+%lo(_N)],%o1
this reference is never resolved;
whereas
i = Thing::N;
does not.
This is a bug introduced into g++2.3.1; it isn't there in g++2.2.2
------------------------------------------
#include <stdio.h>
class Thing{
private: int x;
public: const int N = -1;
Thing(int y);
};
class Bar{ public: void doit(void); };
void Bar::doit(void)
{
int i, j;
i = Thing::N;
printf("i = %d\n", i);
j = (int)Thing::N;
printf("i = %d\n", j);
}
Thing::Thing(int y) { x = y; }
main(){ Bar x; x.doit(); }
Technical Details
Message-ID:
<9211101908.AA13557@tera.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tera.com!rrhShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tera.com!rrh From: rrh@tera.com (Robert R. Henry) Subject: type cast of qualified const member breaks g++2.3.1 Message-ID: <9211101908.AA13557@tera.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 10 Nov 1992 19:08:08 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 35