🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Signal 6 with pure virtual destructor. g++ 2.3.3

#1312
From: unknown
Date: Mon, 04 Jan 1993 18:18
89 lines
2477 bytes
Hi netters!

I get a core dump from the following code, if in separate files,
although everything goes fine if they are grouped together.

-b.h--------------------------------------------------------
class B {
  public:
    virtual ~B() = 0;
};

-b.C--------------------------------------------------------
#include <iostream.h>
#include "b.h"

B::~B() { 
	cout << "B::~B() for: " << this << endl;
}

-main.C-----------------------------------------------------
#include <iostream.h>
#include "b.h"

class A: public B {
  public:
	~A();
};

A::~A() {
	cout << "A::~A() for: " << this << endl;
}

main() {
	A fred;

	cout << "That's all Folks!..." << endl;
	return 0;
}

-test--------------------------------------------------------
> ab
That's all Folks!...
A::~A() for: 0x68fad4d8
Abort(coredump)

...and under gdb:
Program received signal 6, Aborted
0x158c0 in ___stdio_unsup_1 ()

As I said, this is ok:

-main.C------------------------------------------------------
#include <iostream.h>

class B {
  public:
    virtual ~B() = 0;
};

B::~B() { 
	cout << "B::~B() for: " << this << endl;
}

class A: public B {
  public:
	~A();
};

A::~A() {
	cout << "A::~A() for: " << this << endl;
}

main() {
	A fred;

	cout << "That's all Folks!..." << endl;
	return 0;
}

------------------------------------------------------------

Best Regards!
--
+-----------------------------------------------------------------------------+
| Marc Girod - Nokia Telecommunications       Phone: +358-0-511 7703          |
| TL4E - P.O. Box 12                            Fax: +358-0-511 7432          |
| SF-02611 Espoo 61 - Finland              Internet: marc.girod@ntc.nokia.com |
|    X.400: C=FI, A=Elisa, P=Nokia Telecom, UNIT=TRS, SUR=Girod, GIV=Marc     |
+-----------------------------------------------------------------------------+
Technical Details
Message-ID: <GIROD.TMS_OS.KPD.93Jan4201805@kilohp.kiloapo.ts.tele.nokia.fi>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!kilohp.kiloapo.ts.tele.NOkia.FI!girod.tms_os.kpd

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!kilohp.kiloapo.ts.tele.NOkia.FI!girod.tms_os.kpd
From: girod.tms_os.kpd@kilohp.kiloapo.ts.tele.NOkia.FI (unknown)
Subject: Signal 6 with pure virtual destructor. g++ 2.3.3
Message-ID: <GIROD.TMS_OS.KPD.93Jan4201805@kilohp.kiloapo.ts.tele.nokia.fi>
Sender: gnulists@ai.mit.edu
Reply-To: marc.girod@ntc.nokia.com
Organization: /user/girod/.organization
Distribution: gnu
Date: Mon, 4 Jan 1993 18:18:05 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 90