Boost C++ Libraries: Ticket #10084: void_upcast should throw an unregistered_cast exception when it can't find a way to upcast https://svn.boost.org/trac10/ticket/10084 <p> It is possible for the void_caster_register to not include information on how to upcast between types. In version 1.55, void_upcast(lines 314-334) in void_cast.cpp searches the void_caster_register for this information and, if it finds none, returns NULL. If this happens when doing deserialization, it means that all of the deserialized data is thrown away (event though it may have been successfully completed) and the user gets a null pointer back instead. At a minimum, this results in mysterious behavior when deserializing derived classes through a base class pointer. At worst, this may result in a memory leak (haven't investigated this). It seems to me that rather than surprising the user like this, failures to find appropriate cast info in the void_caster_register should cause an unregistered_cast exception (or something similar) so the user will at least know where the problem is. This can happen even though void_upcast the appropriate type information for both the base and derived class. </p> <p> This problem occurs when the void_caster_register is empty, which has happened when both Boost.Serialize and the library of classes to be serialized are created as DLLs on Windows 7 when building using VS2012. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10084 Trac 1.4.3 Steve Hickman <steve.hickman@…> Thu, 12 Jun 2014 14:23:41 GMT <link>https://svn.boost.org/trac10/ticket/10084#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10084#comment:1</guid> <description> <p> Could it be that the problem here is related to this: <a class="ext-link" href="http://stackoverflow.com/questions/12991581/using-static-members-across-static-lib-and-dll-member-value-is-resetting"><span class="icon">​</span>http://stackoverflow.com/questions/12991581/using-static-members-across-static-lib-and-dll-member-value-is-resetting</a> </p> <p> For the problem to occur, the library containing my serializable classes was a DLL but it was linked to other static libraries and the EXE. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 26 Jun 2014 15:44:50 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10084#comment:2 https://svn.boost.org/trac10/ticket/10084#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> uploaded fix to develop </p> Ticket