Boost C++ Libraries: Ticket #3400: Problem with boost::serialization when only operator new[] is overrided https://svn.boost.org/trac10/ticket/3400 <p> Compilation error in serialization when only operator new[] is overrided. It should also be possible to set operator new[] as private, but that will give another error. </p> <pre class="wiki">#include &lt;stdio.h&gt; #include &lt;tchar.h&gt; #include &lt;fstream&gt; #include &lt;boost/type_traits.hpp&gt; #include &lt;boost/type_traits/has_new_operator.hpp&gt; #include &lt;boost/archive/binary_oarchive.hpp&gt; #include &lt;boost/archive/binary_iarchive.hpp&gt; #include &lt;boost/serialization/export.hpp&gt; #include &lt;boost/serialization/shared_ptr.hpp&gt; class A { friend class boost::serialization::access; template&lt;class Archive&gt; void serialize(Archive &amp; ar, const unsigned int version) { ar &amp; m_i; } int m_i; public: void* operator new[](std::size_t) { return NULL; } }; BOOST_CLASS_EXPORT(A) int _tmain(int argc, _TCHAR* argv[]) { A *pa; std::ifstream ifs("test", std::ios_base::in | std::ios_base::binary); { boost::archive::binary_iarchive ia(ifs); ia &gt;&gt; *pa; } return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3400 Trac 1.4.3 Runar Undheim <r.undheim@…> Fri, 04 Sep 2009 11:38:28 GMT <link>https://svn.boost.org/trac10/ticket/3400#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3400#comment:1</guid> <description> <p> The serialization code use the has_new_operator to decide if it should call T::new or ::new. But what should happen if only the operation new for arrays is overridden? If T::new function only should be called when the operator new(size_t) is overridden then the has_new_operator function may be split into three different functions (ex. has_new_operator, has_new_operator_array and has_new_operator_placement)? </p> </description> <category>Ticket</category> </item> <item> <author>Runar Undheim <r.undheim@…></author> <pubDate>Fri, 04 Sep 2009 11:47:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3400#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3400#comment:2</guid> <description> <p> Related to ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3401" title="#3401: Bugs: has_new_operator fail if several new operators is overrided (closed: fixed)">#3401</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Fri, 27 Nov 2009 23:06:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3400#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3400#comment:3</guid> <description> <p> A very intricate issue. You've spent some time on it already. Would you care to spend a little more and create a patch that we could evaluate? </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Fri, 27 Nov 2009 23:06:38 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/3400#comment:4 https://svn.boost.org/trac10/ticket/3400#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Robert Ramey Thu, 10 Dec 2009 22:37:10 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3400#comment:5 https://svn.boost.org/trac10/ticket/3400#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I believe this is fixed by a patch to the trunk in the type_traits library. </p> <p> Robert Ramey </p> Ticket Gael Thu, 16 Sep 2010 22:28:35 GMT <link>https://svn.boost.org/trac10/ticket/3400#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3400#comment:6</guid> <description> <p> This issue doesn't appear to be fixed. I can reproduce the compilation errors when operator new[] is overloaded. Boost is still trying to call the (T::operator new) version to allocate the object. </p> </description> <category>Ticket</category> </item> </channel> </rss>