[Boost-bugs] [Boost C++ Libraries] #11520: pointer_iserializer requires operator delete(void*, size_t) for classes that have a specific operator new

Subject: [Boost-bugs] [Boost C++ Libraries] #11520: pointer_iserializer requires operator delete(void*, size_t) for classes that have a specific operator new
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-07-31 20:59:28


#11520: pointer_iserializer requires operator delete(void*, size_t) for classes
that have a specific operator new
---------------------------------------------+---------------------------
 Reporter: Fabian Kislat <fabian.kislat@…> | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
---------------------------------------------+---------------------------
 Serialization of pointers to objects, which have a class specific operator
 new fails if the class only provides the regular (see
 https://github.com/boostorg/serialization/blob/master/include/boost/archive/detail/iserializer.hpp#L236)

 T::operator delete(void*)

 by requiring definition of

 T::operator delete(void*, std::size_t)

 However, the operator delete with size argument is entirely optional in
 the C++ standard. The comment in the code says this choice was made
 because the delete operator with only one argument is a usual deallocator,
 which the author assumes calls the destructor. This is incorrect in two
 ways:
 a) operator delete never calls the destructor (the delete expression calls
 the destructor and then operator delete to deallocate the storage, see
 sec. 5.3.5 of the standard)
 b) operator delete with a size argument is a usual delete operator (non-
 placement), just like the version with one argument.

 In fact, it seems that the behaviour may be undefined if both versions of
 the delete operator are defined (sec. 5.3.5 paragraph 10).

 I don't know how to test which of the two operators exists, but it seems
 safer to me to use the one-argument version. My existing code stopped
 working after upgrading boost, and I do not have access to the class being
 serialized. I am using an external non-intrusive serialization function.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11520>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC