#5800 closed Bugs (fixed)
lexical_cast doesn't compile without exceptions
Reported by: | Mathias Gaunard | Owned by: | Antony Polukhin |
---|---|---|---|
Milestone: | Boost 1.50.0 | Component: | lexical_cast |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: |
Description
With GCC, simply including <boost/lexical_cast.hpp>
is enough to yield the following error:
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
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.
The reason I need this is because Boost.Math seems to depend on lexical_cast, and I want to use it without exception support.
Change History (7)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Component: | lexical_cast → numeric |
---|---|
Milestone: | To Be Determined → Boost 1.48.0 |
Owner: | changed from | to
Version: | Boost Development Trunk → Boost 1.47.0 |
It is not a lexical_cast bug. Lexical cast uses throw_exception function, which works correct with BOOST_NO_EXCEPTIONS flag.
I`ll redirect this issue to numeric_cast library.
If this bug wont be fixed soon. I
ll fix it myself (it is a trivial bug)
comment:3 by , 11 years ago
Cc: | added |
---|
comment:4 by , 11 years ago
Cc: | removed |
---|---|
Component: | numeric → lexical_cast |
Milestone: | Boost 1.48.0 → Boost 1.50.0 |
Owner: | changed from | to
Status: | new → assigned |
I`ll do some workaround to allow lexical_cast compile with exceptions off even if numeric cast requires exceptions.
comment:5 by , 11 years ago
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.