Boost C++ Libraries: Ticket #5800: lexical_cast doesn't compile without exceptions https://svn.boost.org/trac10/ticket/5800 <p> With GCC, simply including <code>&lt;boost/lexical_cast.hpp&gt;</code> is enough to yield the following error: </p> <pre class="wiki">In file included from /media/data/dev/svn/boost-trunk/boost/numeric/conversion/converter.hpp:14:0, from /media/data/dev/svn/boost-trunk/boost/numeric/conversion/cast.hpp:32, from /media/data/dev/svn/boost-trunk/boost/lexical_cast.hpp:40, test.cpp:14: /media/data/dev/svn/boost-trunk/boost/numeric/conversion/converter_policies.hpp: In member function ‘void boost::numeric::def_overflow_handler::operator()(boost::numeric::range_check_result)’: /media/data/dev/svn/boost-trunk/boost/numeric/conversion/converter_policies.hpp:162:31: error: exception handling disabled, use -fexceptions to enable </pre><p> It would be nice if Boost.Lexical_cast (and Boost.Numeric Convert that it seems to use) could be made to work with exceptions disabled. </p> <p> The reason I need this is because Boost.Math seems to depend on lexical_cast, and I want to use it without exception support. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5800 Trac 1.4.3 Mathias Gaunard Sun, 21 Aug 2011 19:17:48 GMT <link>https://svn.boost.org/trac10/ticket/5800#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5800#comment:1</guid> <description> <p> The best solution would be to replace all references to "throw" by the macro BOOST_THROW_EXCEPTION which expands to the right thing depending on whether exceptions are enabled or not. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Sun, 21 Aug 2011 19:43:58 GMT</pubDate> <title>owner, version, component, milestone changed https://svn.boost.org/trac10/ticket/5800#comment:2 https://svn.boost.org/trac10/ticket/5800#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">nasonov</span> to <span class="trac-author">Douglas Gregor</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost Development Trunk</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">lexical_cast</span> → <span class="trac-field-new">numeric</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.48.0</span> </li> </ul> <p> It is not a lexical_cast bug. Lexical cast uses throw_exception function, which works correct with BOOST_NO_EXCEPTIONS flag. </p> <p> I`ll redirect this issue to numeric_cast library. If this bug won<code>t be fixed soon. I</code>ll fix it myself (it is a trivial bug) </p> Ticket Antony Polukhin Sun, 21 Aug 2011 19:44:21 GMT cc set https://svn.boost.org/trac10/ticket/5800#comment:3 https://svn.boost.org/trac10/ticket/5800#comment:3 <ul> <li><strong>cc</strong> <span class="trac-author">antoshkka@…</span> added </li> </ul> Ticket Antony Polukhin Tue, 21 Feb 2012 19:30:58 GMT owner, status, component, milestone changed; cc deleted https://svn.boost.org/trac10/ticket/5800#comment:4 https://svn.boost.org/trac10/ticket/5800#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">antoshkka@…</span> removed </li> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author">Antony Polukhin</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>component</strong> <span class="trac-field-old">numeric</span> → <span class="trac-field-new">lexical_cast</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.48.0</span> → <span class="trac-field-new">Boost 1.50.0</span> </li> </ul> <p> I`ll do some workaround to allow lexical_cast compile with exceptions off even if numeric cast requires exceptions. </p> Ticket Antony Polukhin Sat, 25 Feb 2012 17:06:06 GMT <link>https://svn.boost.org/trac10/ticket/5800#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5800#comment:5</guid> <description> <p> Updated in <a class="changeset" href="https://svn.boost.org/trac10/changeset/77116" title="Updates #5800 (partially fix lexical cast compilation with disabled ...">r77116</a> (added tests, some workarounds, updated documentation, enabled exception handling with -fvisibility=hidden flag)<br /> Unable to make a good workaround, without copy-pasting a lot of numeric_cast code. Continue to wait for <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5731" title="#5731: Bugs: Failure in boost/numeric/conversion when compiled without exceptions (closed: fixed)">#5731</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5076" title="#5076: Bugs: numeric/conversion/converter_policies.hpp won't build with gcc ... (closed: fixed)">#5076</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5393" title="#5393: Bugs: cast.hpp does not compile with exceptions off (closed: fixed)">#5393</a> resolutions. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Mon, 05 Mar 2012 17:11:23 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5800#comment:6 https://svn.boost.org/trac10/ticket/5800#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/77234" title="Fixes #5731, fixes #5076, fixes #5393, fixes #5800 Now numeric_cast ...">[77234]</a>) Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5731" title="#5731: Bugs: Failure in boost/numeric/conversion when compiled without exceptions (closed: fixed)">#5731</a>, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5076" title="#5076: Bugs: numeric/conversion/converter_policies.hpp won't build with gcc ... (closed: fixed)">#5076</a>, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5393" title="#5393: Bugs: cast.hpp does not compile with exceptions off (closed: fixed)">#5393</a>, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5800" title="#5800: Bugs: lexical_cast doesn't compile without exceptions (closed: fixed)">#5800</a> Now numeric_cast (and lexical_cast) can be compiled with disabled exceptions </p> Ticket Antony Polukhin Mon, 05 Mar 2012 18:44:33 GMT <link>https://svn.boost.org/trac10/ticket/5800#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5800#comment:7</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/77236" title="More strict tests for disabled exceptions (for fixed #5800)">[77236]</a>) More strict tests for disabled exceptions (for fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5800" title="#5800: Bugs: lexical_cast doesn't compile without exceptions (closed: fixed)">#5800</a>) </p> </description> <category>Ticket</category> </item> </channel> </rss>