Actions
| Post | |
| Subscribe | |
| Unsubscribe |
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
::delete and deleting destructors
- To: cxx-abi-dev@xxxxxxxxxxxxxxxx
- Subject: ::delete and deleting destructors
- From: Jason Merrill <jason@xxxxxxxxxx>
- Date: Wed, 05 Sep 2007 12:21:18 -0400
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097seems to indicate a problem with the ABI. The standard requires that ::delete use the global operator delete, but properly deleting an object of a type with a virtual destructor requires that use the deleting destructor, which will call the operator delete declared in the class, if any.
G++ gets this wrong by always calling the global operator delete, which means freeing the wrong pointer in the presence of multiple inheritance.
ICC tries to split the difference by using the deleting destructor if the static type doesn't have a user-declared op delete, so they free the wrong pointer if the static type of the object has a user-declared op delete, and call the wrong op delete if the static type doesn't but the dynamic type does.
It seems to me that fixing this would require a change to the ABI, either to return the address to be deleted from the non-deleting destructor, add an additional deleting destructor, or add a hidden parameter to the existing deleting destructor. The last could probably be implemented as a backwards-compatible change.
Jason
- Follow-Ups:
- Re: [cxx-abi-dev] ::delete and deleting destructors
- From: Mark Mitchell
- Re: [cxx-abi-dev] ::delete and deleting destructors
- Prev by Date: Re: Fw: [cxx-abi-dev] Decimal Floating Point mangling was(Fw: [cxx-abi-dev] C++0x: Mangling of rvalue reference type)s
- Next by Date: Re: [cxx-abi-dev] ::delete and deleting destructors
- Previous by thread: Re: [cxx-abi-dev] C++0x: Mangling of decltype
- Next by thread: Re: [cxx-abi-dev] ::delete and deleting destructors
- Index(es):