Boost C++ Libraries: Ticket #12367: Using an offset_ptr type as value for multi_index_container causes compile error with 1.59+ https://svn.boost.org/trac10/ticket/12367 <p> Our project uses multi_index_container in a Boost interprocess shared memory segment. This has always compiled fine until we tried upgrading to from 1.58 to 1.61. It turns out that something introduced in 1.59 causes a compile error. </p> <p> Our code uses a boost::interprocess::offset_ptr as the value for a multi_index_container instantiated in the shared memory segment. Apparently anything with 1.59 or higher does not like this. </p> <p> This has only been seen compiling with Visual Studio 2013. </p> <p> I have attached the slightly modified boost example that causes the error and the error output. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12367 Trac 1.4.3 Michael Watkins <michael.watkins2@…> Mon, 01 Aug 2016 19:18:46 GMT attachment set https://svn.boost.org/trac10/ticket/12367 https://svn.boost.org/trac10/ticket/12367 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boosttest.cpp</span> </li> </ul> <p> Example that causes the compile error, slightly modified from the boost multi_index/interprocess interoperability example. </p> Ticket Michael Watkins <michael.watkins2@…> Mon, 01 Aug 2016 19:19:14 GMT attachment set https://svn.boost.org/trac10/ticket/12367 https://svn.boost.org/trac10/ticket/12367 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">20160801 boosttest compile error.txt</span> </li> </ul> <p> The compile error caused by the boosttest.cpp example. </p> Ticket Joaquín M López Muñoz Mon, 08 Aug 2016 16:26:10 GMT <link>https://svn.boost.org/trac10/ticket/12367#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12367#comment:1</guid> <description> <p> Hi Michael, </p> <p> Sorry about my late answering, I wasn't monitoring the email inbox these tickets notify to. </p> <p> As for your problem, I <em>think</em> it is a rather obscure bug having to do with <code>boost::interprocess:offset_ptr</code> convertibility machinery. I'll try to isolate this into something I can go with to Boost.Interprocess's author. In the meantime, please try replacing line 37 of boost/multi_index/detail/raw_ptr.hpp: </p> <pre class="wiki"> return p==Pointer(0)?0:&amp;*p; </pre><p> with </p> <pre class="wiki"> return !p?0:&amp;*p; </pre><p> Could you please report back if this solves your problem? Thanks for spotting this bug. </p> </description> <category>Ticket</category> </item> <item> <author>Michael Watkins <michael.watkins2@…></author> <pubDate>Mon, 08 Aug 2016 18:16:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12367#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12367#comment:2</guid> <description> <p> Hi Joaquin: </p> <p> The above change to replace line 37 does indeed fix the compile problem. </p> <p> Thanks for your help! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Wed, 10 Aug 2016 15:21:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12367#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12367#comment:3</guid> <description> <p> Hi again, </p> <p> Ion (the author of Boost.Container) has applied the following commit: </p> <p> <a class="ext-link" href="https://github.com/boostorg/interprocess/commit/8253c1b0add95ade098ae2d481f52a3bd4be6da5"><span class="icon">​</span>https://github.com/boostorg/interprocess/commit/8253c1b0add95ade098ae2d481f52a3bd4be6da5</a> </p> <p> Would you mind verifying if this (<em>without</em> my patch above) solves the problem so that we can close the ticket? Thank you, </p> </description> <category>Ticket</category> </item> <item> <author>Michael Watkins <michael.watkins2@…></author> <pubDate>Wed, 10 Aug 2016 17:50:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12367#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12367#comment:4</guid> <description> <p> Hello Joaquin: </p> <p> Ion's fix works perfectly (verified without your above patch). Thanks to both of you for all your help! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Thu, 11 Aug 2016 08:04:49 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12367#comment:5 https://svn.boost.org/trac10/ticket/12367#comment:5 <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> Ticket