Boost C++ Libraries: Ticket #12652: boost::optional<DefaultConstructable>::operator= chooses wrong overload for {} https://svn.boost.org/trac10/ticket/12652 <pre class="wiki">boost::optional&lt;int&gt; op = 5; // creates engaged optional op = {}; // currently does op = 0; </pre><p> For most types operator={} assigns from a value-constructed value of that type. That is the behavior of std::experimental::optional but not boost::optional&lt;T&gt;. It chooses the T&amp;&amp; overload. I think the standard avoids it by having the assign-from-T operator= be templated on U instead, which doesn't match {}. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12652 Trac 1.4.3 mathias@… Wed, 07 Dec 2016 01:04:22 GMT attachment set https://svn.boost.org/trac10/ticket/12652 https://svn.boost.org/trac10/ticket/12652 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test.cpp</span> </li> </ul> <p> Shows the issue. (Compiled with g++6.2 with no extra args) </p> Ticket akrzemi1 Tue, 14 Feb 2017 12:30:35 GMT status, version, milestone changed; resolution set https://svn.boost.org/trac10/ticket/12652#comment:1 https://svn.boost.org/trac10/ticket/12652#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.61.0</span> → <span class="trac-field-new">Boost 1.63.0</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.63.0</span> </li> </ul> <p> Already fixed in 1.63 </p> Ticket