🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug in overloading delete (gcc 2.2.2 core dumps)

#881
From: Brendan Kehoe
Date: Wed, 02 Sep 1992 07:21
52 lines
2116 bytes
> gcc core dumps trying to compile the following code:
> 
> ------begin included file bug1.cc--------
>     #include <sys/stdtypes.h>
> 
>     class mem
>     {
>     public:
> 	mem() {};
>     //     virtual ~mem() {};
> 
> 	void operator delete(void *v, size_t s) 	{};
>     };
> 
>     class derived : public mem {
>     public:
>        derived()	{} 
>     //    virtual ~derived()	{} 
> 
>        function(derived *d)	{ delete d; }
>     };
> 
>     main()
>     {
>     }
> ------end included file bug1.cc--------
>     gcc bug1.cc
>     bug1.cc: In method `int  derived::function (class derived*)':
>     bug1.cc:18: too few arguments for method `operator delete'
>     cp-method.c:2217: failed assertion `rval != error_mark_node'
>     gcc: Internal compiler error: program cc1plus got fatal signal 6

This is fixed in the next release (don't ask for a date).

> If you remove the comments in front of the destructor definitions in the
> code above, you get the following error messages when compiling:
> 
>     what> gcc bug1.cc
>     bug1.cc: In method `mem::~mem ()':
>     bug1.cc:7: too few arguments for method `operator delete'
>     bug1.cc: In method `derived::~derived ()':
>     bug1.cc:16: too few arguments for method `operator delete'
>     bug1.cc: In method `int  derived::function (class derived*)':
>     bug1.cc:18: warning: control reaches end of non-void function

This is fixed, also.

Brendan

--
Brendan Kehoe                                               brendan@cygnus.com
Cygnus Support, Palo Alto, CA                                  +1 415 322 3811
Technical Details
Message-ID: <9209020721.AA02299@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!brendan
References: <9206260039.AA11751@ibm3270.manasys.co.nz>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!brendan
From: brendan@cygnus.com (Brendan Kehoe)
Subject: Bug in overloading delete (gcc 2.2.2 core dumps)
Message-ID: <9209020721.AA02299@cygnus.com>
Sender: gnulists@ai.mit.edu
Reply-To: brendan@cygnus.com
Organization: GNUs Not Usenet
References: <9206260039.AA11751@ibm3270.manasys.co.nz>
Distribution: gnu
Date: Wed, 2 Sep 1992 07:21:46 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 53