Boost C++ Libraries: Ticket #11270: bost::shared_ptr && boost::optional fail to compile in single if statement https://svn.boost.org/trac10/ticket/11270 <pre class="wiki">/* using sun 12.4 with std=c++11 does not compile shared_ptr and optional in single if statement , example : if ( ptr &amp;&amp; opt_value ) giving following message : Error: The operation "boost::shared_ptr&lt;int&gt; &amp;&amp; boost::optional&lt;int&gt;" is illegal boost version : 1.58 compilation command : /appl/toolbox/solarisstudio12.4/bin/CC -std=c++11 -I/home/vvenedik/C++/boost_1_58_0 -c main_5.cpp -o main_5.o */ #include &lt;boost/optional.hpp&gt; #include &lt;boost/shared_ptr.hpp&gt; #include &lt;iostream&gt; int main() { boost::shared_ptr&lt;int&gt; ptr(new int) ; boost::optional&lt;int&gt; opt_int; opt_int = 5; if ( ptr &amp;&amp; opt_int ) { std::cout &lt;&lt; "compiled and ran OK" &lt;&lt; std::endl; } } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11270 Trac 1.4.3 John Maddock Thu, 28 May 2015 16:14:21 GMT component changed; owner set https://svn.boost.org/trac10/ticket/11270#comment:1 https://svn.boost.org/trac10/ticket/11270#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Peter Dimov</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">smart_ptr</span> </li> </ul> Ticket Peter Dimov Thu, 28 May 2015 23:15:50 GMT <link>https://svn.boost.org/trac10/ticket/11270#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11270#comment:2</guid> <description> <p> Does <code>ptr &amp;&amp; ptr</code> work? <code>opt_int &amp;&amp; opt_int</code>? </p> </description> <category>Ticket</category> </item> </channel> </rss>