Boost C++ Libraries: Ticket #6974: boost::optional compilation error with boost::function and boost::fusion::vector https://svn.boost.org/trac10/ticket/6974 <p> If you compile the following on g++ 4.4.5, it will fail to compile because the optional_base copy constructor and destructor are protected. </p> <p> boost::optional&lt; boost::fusion::vector1&lt;boost::function0&lt;void&gt; &gt; &gt; </p> <p> A duplication program is attached. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6974 Trac 1.4.3 Jonathan Jones <jonathan.jones@…> Fri, 08 Jun 2012 21:16:46 GMT attachment set https://svn.boost.org/trac10/ticket/6974 https://svn.boost.org/trac10/ticket/6974 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">optional.cpp</span> </li> </ul> Ticket Steven Watanabe Fri, 15 Feb 2013 21:36:33 GMT <link>https://svn.boost.org/trac10/ticket/6974#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6974#comment:1</guid> <description> <p> Well that's annoying. optional_base is an implementation detail, but it looks like it's escaping while resolving overload resolution for the copy constructor of optional_base, because of the enable_if in the (converting) constructor of fusion::vector1. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 16 Feb 2013 00:10:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6974#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6974#comment:2</guid> <description> <p> This particular bug appears to be fixed in gcc 4.7. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 16 Feb 2013 00:37:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6974#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6974#comment:3</guid> <description> <p> I'm not quite sure where the best place to fix this is. </p> <ul><li>is_convertible should never fail, but it's probably not feasible to fix it. </li><li>fusion::vector1 shouldn't cause overload resolution to fail, but I don't see any way to avoid this problem, given the limitations of is_convertible. </li><li>I could create a special case for is_convertible for boost::function, but it would be wrong in some edge cases that a compiler intrinsic (or perhaps a C++11 implementation) would be able to get right. </li><li>That leaves making the copy constructor of optional_base public. This ignores the underlying problem that external code is making assumptions about what it can do with an arbitrary type. I really hate to hack the code like this when it isn't the source of the problem. </li><li>And of course the final option is to modify the constructors so that optional_base is never passed to a function that requires overload resolution against T. This one is out because it's too messy. </li></ul> </description> <category>Ticket</category> </item> <item> <author>Jonathan Jones <jonathan.jones@…></author> <pubDate>Tue, 19 Feb 2013 15:54:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6974#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6974#comment:4</guid> <description> <p> For what it's worth, the local workaround we deployed was to makes the optional_base copy constructor and destructor public, but _only_ when the BOOST_IS_CONVERTIBLE macro isn't defined. When this macro _is_ defined, is seems to be implemented in terms of lower-level compiler intrinsics, which do a better job than the boost::is_convertible implementation. </p> </description> <category>Ticket</category> </item> </channel> </rss>