Boost C++ Libraries: Ticket #4759: shared_ptr to bool cast with Intel C++ Composer XE 2011 https://svn.boost.org/trac10/ticket/4759 <p> shared_ptr-to-bool cast sometimes doesn't work on Intel C++ Compiler 11.1. </p> <p> Suggested patch: </p> <pre class="wiki">--- boost/smart_ptr/detail/operator_bool.hpp Пн мар 2 10:45:22 2009 +++ boost/smart_ptr/detail/operator_bool.hpp Чт сен 2 23:30:11 2010 @@ -6,7 +6,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#if ( defined(__SUNPRO_CC) &amp;&amp; BOOST_WORKAROUND(__SUNPRO_CC, &lt; 0x570) ) || defined(__CINT__) +#if ( defined(__SUNPRO_CC) &amp;&amp; BOOST_WORKAROUND(__SUNPRO_CC, &lt; 0x570) ) || defined(__CINT__) || defined (BOOST_INTEL) operator bool () const { </pre><p> As test <a class="ext-link" href="http://sourceforge.net/projects/asio-samples/"><span class="icon">​</span>asio-samples project</a> may be used. Watch at svn repository for the echo_server project: /src/ma/echo/server/session_manager.cpp:151. The "while" cycle doesn't work right (cycle works when shared ptr "active_session" points to nothing) without the suggested patch. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4759 Trac 1.4.3 abrarov@… Tue, 19 Oct 2010 14:17:39 GMT attachment set https://svn.boost.org/trac10/ticket/4759 https://svn.boost.org/trac10/ticket/4759 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">shared_ptr_operator_bool.patch</span> </li> </ul> <p> Suggested patch </p> Ticket Peter Dimov Tue, 19 Oct 2010 16:34:52 GMT <link>https://svn.boost.org/trac10/ticket/4759#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:1</guid> <description> <p> Can you please attach a simple test case? </p> </description> <category>Ticket</category> </item> <item> <author>abrarov@…</author> <pubDate>Tue, 19 Oct 2010 18:07:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4759#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4759#comment:1" title="Comment 1">pdimov</a>: </p> <blockquote class="citation"> <p> Can you please attach a simple test case? </p> </blockquote> <p> I tried to provide a simple test case but it's not so simple (simple tests passes well).<br /> Even in echo_server at some places Intel C++ Compiler works well (but failes in many places too).<br /> The echo_server project is rather simple - it uses only Boost C++ Libraries and "standard" MS Windows headers. So it is rather simple to build it (from MS Visual Studio with integrated Intel C++ Compiler - use /build/intel11/asio-samples.sln).<br /> Make test without patch and within it - and You'll see the difference. </p> </description> <category>Ticket</category> </item> <item> <author>abrarov@…</author> <pubDate>Thu, 24 Feb 2011 23:25:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4759#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:3</guid> <description> <p> It seems (working with Boost 1.46 with </p> <pre class="wiki">#undef BOOST_NO_RVALUE_REFERENCES </pre><p> added to <em>boost/config/compiler/intel.hpp</em>) that compiler option (added from <em>Commind Line</em> memo in project settings) <strong><em>/vmg</em></strong> is the source of problem. </p> <p> I will update <a class="ext-link" href="http://sourceforge.net/projects/asio-samples/"><span class="icon">​</span>asio-samples project</a> in a week to provide public access to Intel-Compiler-12-based projects. </p> </description> <category>Ticket</category> </item> <item> <author>abrarov@…</author> <pubDate>Thu, 24 Feb 2011 23:47:12 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4759 https://svn.boost.org/trac10/ticket/4759 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">intel_rvalue_ref_on.patch</span> </li> </ul> <p> Turn on rvalue referense support in Intel C++ Compiler 12 </p> Ticket abrarov@… Sat, 05 Mar 2011 11:47:17 GMT <link>https://svn.boost.org/trac10/ticket/4759#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4759#comment:3" title="Comment 3">abrarov@…</a>: </p> <blockquote class="citation"> <p> It seems (working with Boost 1.46 with </p> <pre class="wiki">#undef BOOST_NO_RVALUE_REFERENCES </pre><p> added to <em>boost/config/compiler/intel.hpp</em>) that compiler option (added from <em>Commind Line</em> memo in project settings) <strong><em>/vmg</em></strong> is the source of problem. </p> <p> I will update <a class="ext-link" href="http://sourceforge.net/projects/asio-samples/"><span class="icon">​</span>asio-samples project</a> in a week to provide public access to Intel-Compiler-12-based projects. </p> </blockquote> <p> Done. Project "echo_server" works fine with ICC 12.x and suggested patch and crashes because of shared_ptr-to-bool cast (src/ma/echo/server/session_manager.cpp: line 316) without patch. </p> </description> <category>Ticket</category> </item> <item> <author>abrarov@…</author> <pubDate>Fri, 06 Apr 2012 12:32:51 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4759 https://svn.boost.org/trac10/ticket/4759 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">cpp_test.zip</span> </li> </ul> <p> Problem showing test </p> Ticket abrarov@… Fri, 06 Apr 2012 12:38:34 GMT <link>https://svn.boost.org/trac10/ticket/4759#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:5</guid> <description> <p> Test environment:<br /> </p> <ol><li>Windows 7 Ultimate x86 Russian.<br /> </li><li>MS Visual Studio 2010 SP1.<br /> </li><li>Intel C++ Composer XE 2011 update 7. </li></ol><p> See cpp_test.zip attachment for test showing problem in debug mode only. Note /vmg compiler option (not needed for MSVC 10.0, but required for Intel C++ Composer). </p> </description> <category>Ticket</category> </item> <item> <author>abrarov@…</author> <pubDate>Fri, 06 Apr 2012 13:10:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4759#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:6</guid> <description> <p> Test environment: </p> <ol start="4"><li>Boost C++ Libraries 1.49.0 </li></ol> </description> <category>Ticket</category> </item> <item> <author>abrarov@…</author> <pubDate>Sat, 07 Apr 2012 16:06:46 GMT</pubDate> <title>version, summary changed https://svn.boost.org/trac10/ticket/4759#comment:7 https://svn.boost.org/trac10/ticket/4759#comment:7 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.44.0</span> → <span class="trac-field-new">Boost 1.49.0</span> </li> <li><strong>summary</strong> <span class="trac-field-old">shared_ptr to bool cast with Intel C++ Compiler 11.1</span> → <span class="trac-field-new">shared_ptr to bool cast with Intel C++ Composer XE 2011</span> </li> </ul> Ticket Ross MacGregor <rossmpublic.gmail.com> Tue, 26 Feb 2013 00:52:53 GMT <link>https://svn.boost.org/trac10/ticket/4759#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:8</guid> <description> <p> Related bug <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8152" title="#8152: Bugs: operator_bool write access violation error in MSVC builds (closed: invalid)">#8152</a>. </p> <p> I am seeing the same issue with MSVC-9 and MSVC-10 compilers. The shared_ptr to bool conversion is causing write access violations when using the /vmg option. This looks like a compiler bug to me, as I reproduced it with the standard safe bool idiom implementation on a simple class. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ross MacGregor <rossmpublic.gmail.com></dc:creator> <pubDate>Fri, 01 Mar 2013 01:42:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4759#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4759#comment:9</guid> <description> <p> My problem with the MSVC compilers turned out to be a binary incompatibility issue. I was using the pointers_to_members pragma but I did not apply it carefully enough (which looks rather difficult). I ended up with multiple member references using different internal representations. I violated the one definition rule. </p> <p> This also may be the cause of this problem too. Maybe the /vmg option is not being consistently applied for the same smart pointer types? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Wed, 11 Dec 2013 18:26:11 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4759#comment:10 https://svn.boost.org/trac10/ticket/4759#comment:10 <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">invalid</span> </li> </ul> <p> Closing as too old and possibly no longer relevant. </p> Ticket