Article View: gnu.g++.bug
Article #269Re: Constructor not called
From: Mike Stump
Date: Thu, 16 Apr 1992 11:34
Date: Thu, 16 Apr 1992 11:34
47 lines
1866 bytes
1866 bytes
Shouldn't you use gas and GNU ld or collect? Sounds like an
installation problem to me.
> From: Ron.Sommeling@cwi.nl (Ron Sommeling)
> Newsgroups: gnu.g++.bug
> Subject: Constructor not called
> Message-Id: <5858@charon.cwi.nl>
> Date: 15 Apr 92 10:00:46 GMT
> Organization: CWI, Amsterdam
> To: bug-g++@prep.ai.mit.edu
> Machine: SPARCstation 1 running SunOS 4.1.1
> Compiler: g++ 2.1
> % cat t.C
> #include <iostream.h>
> class q {
> public:
> q(int i) { cout << "constructor with i = " << i << endl; }
> ~q() { cout << "destructor" << endl; }
> };
> q a(3);
> main() {
> q b(2);
> }
> % g++ t.C
> Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.1/specs
> gcc version 2.1
> /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.1/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 t3.C /usr/tmp/cca03214.i
> GNU CPP version 2.1 (sparc)
> /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.1/cc1plus /usr/tmp/cca03214.i -quiet -dumpbase t3.cc -version -o /usr/tmp/cca03214.s
> GNU C++ version 2.1 (sparc) compiled by GNU C version 2.1.
> as -o t3.o /usr/tmp/cca03214.s
> ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.1/ -L/usr/local/lib/ t3.o -lg++ -lgcc -lc -lgcc
> % ./a.out
> constructor with i = 2
> destructor
> Shouldn't that be:
> constructor with i = 3
> constructor with i = 2
> destructor
> destructor
Technical Details
Message-ID:
<9204161134.AA11357@cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrsShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs From: mrs@cygnus.com (Mike Stump) Subject: Re: Constructor not called Message-ID: <9204161134.AA11357@cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 16 Apr 1992 11:34:33 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 48