Boost C++ Libraries: Ticket #11461: signals2/signal.hpp does not compile with exceptions off https://svn.boost.org/trac10/ticket/11461 <p> boost/signals2/signal.hpp includes boost/signals2/detail/slot_call_iterator.hpp </p> <p> which uses throw (instead of boost::throw_exception as it should) </p> <p> with exceptions off, you cannot use throw(), try, catch, etc., hence BOOST_TRY, BOOST_CATCH, BOOST_RETHROW </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11461 Trac 1.4.3 peterpastor@… Thu, 09 Jul 2015 18:15:22 GMT attachment set https://svn.boost.org/trac10/ticket/11461 https://svn.boost.org/trac10/ticket/11461 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">slot_call_iterator_throw_bug.diff</span> </li> </ul> Ticket Frank Mori Hess Fri, 10 Jul 2015 19:50:42 GMT type changed https://svn.boost.org/trac10/ticket/11461#comment:1 https://svn.boost.org/trac10/ticket/11461#comment:1 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> </ul> <p> The proposed change may make it compile, but IIRC it will break automatic slot disconnection when compiling without exceptions. Boost libraries are not required to work without exception support. I'm leaving this ticket open as a feature request, but I have no immediate plans to resolve it. </p> Ticket gromer@… Wed, 15 Jul 2015 17:25:08 GMT <link>https://svn.boost.org/trac10/ticket/11461#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11461#comment:2</guid> <description> <p> I don't see how this can break automatic slot disconnection. The presumption is that <code>boost::throw_exception</code> either throws an exception (no change from the current code) or terminates the program (which makes slot disconnection a moot point). </p> <p> Many large codebases are built without exceptions; whether or not Boost is required to support them, it's a major deficiency for it not to. Why not just take the fix, when it's so trivial? </p> </description> <category>Ticket</category> </item> <item> <author>gromer@…</author> <pubDate>Wed, 15 Jul 2015 17:31:02 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/11461#comment:3 https://svn.boost.org/trac10/ticket/11461#comment:3 <ul> <li><strong>cc</strong> <span class="trac-author">gromer@…</span> added </li> </ul> Ticket Frank Mori Hess Wed, 15 Jul 2015 17:34:32 GMT <link>https://svn.boost.org/trac10/ticket/11461#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11461#comment:4</guid> <description> <p> Perhaps I should have said "break the program when it tries to use automatic slot disconnection"? Signals2 causing the program to terminate when the signals2 is used as it is documented to be used is about as broken as broken gets. </p> </description> <category>Ticket</category> </item> <item> <author>gromer@…</author> <pubDate>Wed, 15 Jul 2015 18:55:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11461#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11461#comment:5</guid> <description> <p> Oh, I see what you're saying: Signals2 relies on this exception for non-exceptional control flow. That being the case, yes, Signals2 shouldn't compile with exceptions disabled, but that means we have the opposite problem: it doesn't fail to compile reliably enough. It looks like Clang will compile this code just fine with exceptions disabled, and although it doesn't compile in gcc, I would argue that's a bug. The line of code at issue is a re-throw inside a <code>catch</code> block, so it's harmless when exceptions are disabled, because it will never be reached. </p> <p> In any event, this is the wrong place for the error to occur: the code that makes Signals2 unsafe with exceptions disabled is the code that "swallows" exceptions: the <code>catch</code> blocks that don't re-throw in <code>last_value.hpp</code> and <code>optional_last_value.hpp</code>. Those whole functions (or the whole files, like <code>boost/thread/future.hpp</code>) should be wrapped in <code>#ifndef BOOST_NO_EXCEPTIONS</code>. </p> </description> <category>Ticket</category> </item> <item> <author>gromer@…</author> <pubDate>Wed, 15 Jul 2015 20:11:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11461#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11461#comment:6</guid> <description> <p> Scratch that last update; I was talking out of my ass. </p> </description> <category>Ticket</category> </item> <item> <author>gromer@…</author> <pubDate>Thu, 16 Jul 2015 21:26:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11461#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11461#comment:7</guid> <description> <p> Why does Signals2 use <code>boost::throw_exception()</code> where the exception is originally thrown? <code>boost::throw_exception()</code> is tantamount to <code>abort()</code> when exceptions are disabled, so it seems like it shouldn't be used for conditions that are expected to occur in normal use. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Frank Mori Hess</dc:creator> <pubDate>Tue, 21 Jul 2015 15:25:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11461#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11461#comment:8</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11461#comment:7" title="Comment 7">gromer@…</a>: </p> <blockquote class="citation"> <p> Why does Signals2 use <code>boost::throw_exception()</code> where the exception is originally thrown? </p> </blockquote> <p> I've removed all usage of boost::throw_exception from develop. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Frank Mori Hess</dc:creator> <pubDate>Sun, 15 May 2016 04:18:33 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11461#comment:9 https://svn.boost.org/trac10/ticket/11461#comment:9 <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">fixed</span> </li> </ul> <p> signals2 should be mostly usable now without exceptions, the changes will be in 1.62. </p> Ticket