Boost C++ Libraries: Ticket #12105: Support std::exception_ptr in boost::promise set_exception ?? https://svn.boost.org/trac10/ticket/12105 <p> MSC_VER=1600,BOOST_VER=106000 invalid catch </p> <pre class="wiki">void foo_lang_test() { printf("MSC_VER=%d,BOOST_VER=%d\n", _MSC_VER , BOOST_VERSION ); boost::promise&lt;void&gt; pp; try { throw std::runtime_error("aa"); } catch(...) { pp.set_exception(std::current_exception()); } try { pp.get_future().get(); } catch(std::exception&amp; e) { printf("catch %s\n", e.what()); } catch(...) { printf("invalid catch\n"); } } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12105 Trac 1.4.3 John Maddock Thu, 31 Mar 2016 08:14:44 GMT owner, component changed https://svn.boost.org/trac10/ticket/12105#comment:1 https://svn.boost.org/trac10/ticket/12105#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">John Maddock</span> to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">TR1</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket viboes Tue, 09 Aug 2016 00:30:28 GMT status, type changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/12105#comment:2 https://svn.boost.org/trac10/ticket/12105#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> <p> I can not take this in account unless boost::exception_ptr accepts std::exception_ptr </p> Ticket joseph@… Tue, 23 Jan 2018 16:30:07 GMT <link>https://svn.boost.org/trac10/ticket/12105#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12105#comment:3</guid> <description> <p> Is there some reason you can't add a #define to use std::exception_ptr instead of boost::exception_ptr? The 2 are totally incompatible so any system libraries using std::exception_ptr (such as ISO/IEC TS 22277:2017 coroutines) become a real burden to use with boost future (which has many wonderful features std::future does not). There does not appear to be a way to reliably convert between std::exception_ptr and boost::exception_ptr and the limited method I have found requires throwing 2 additional times which is really wasteful. </p> <pre class="wiki">namespace boost { template &lt;&gt; inline exception_ptr copy_exception(std::exception_ptr const &amp;ex) { try { std::rethrow_exception(ex); } catch (const std::exception&amp; e) { try { throw boost::enable_current_exception(e); } catch (...) { return boost::current_exception(); } } catch (...) { try { throw boost::enable_current_exception(std::runtime_error("unknown exception")); } catch (...) { return boost::current_exception(); } } } } </pre> </description> <category>Ticket</category> </item> </channel> </rss>