🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

core dump (related to cast operator)

#220
From: Thomas M. Breuel
Date: Sun, 09 Aug 1992 17:38
28 lines
1807 bytes
The following program cause the compiler to dump core. I would
actually like to see the restriction on cast operators (namely, that
they can only be defined as member functions) be dropped, at least in
GNU C++. Allowing the definition of cast operators outside of classes
would make it easier to integrate different class libraries.

================================================================
struct ipoint2 {int x,y;};
struct vec2 {float v[2]; vec2(float x,float y) {v[0]=x; v[1]=y;}};

operator vec2(ipoint2 &p) { return vec2(p.x,p.y); }

main() {
	ipoint2 p;
}
================================================================
cd /fs/vision01/tmb/src/char/
gcc -v -g -c test.cc
Reading specs from /sym/gnu/lib/gcc-lib/sparc/2.2.2/specs
gcc version 2.2.2
 /sym/gnu/lib/gcc-lib/sparc/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -g test.cc /local/tmp/cca11207.i
GNU CPP version 2.2.2 (sparc)
 /sym/gnu/lib/gcc-lib/sparc/2.2.2/cc1plus /local/tmp/cca11207.i -quiet -dumpbase test.cc -g -version -o /local/tmp/cca11207.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
test.cc:4: operator <typename> requires empty parameter list
gcc: Internal compiler error: program cc1plus got fatal signal 11

Compilation exited abnormally with code 1 at Sun Aug  9 15:34:56
Technical Details
Message-ID: <9208091338.AA02624@idiap.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idiap.CH!tmb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idiap.CH!tmb
From: tmb@idiap.CH (Thomas M. Breuel)
Subject: core dump (related to cast operator)
Message-ID: <9208091338.AA02624@idiap.ch>
Sender: gnulists@ai.mit.edu
Reply-To: tmb@idiap.ch
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 9 Aug 1992 17:38:52 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 29