Opened 11 years ago
Closed 11 years ago
#5731 closed Bugs (fixed)
Failure in boost/numeric/conversion when compiled without exceptions
Reported by: | Owned by: | Douglas Gregor | |
---|---|---|---|
Milestone: | To Be Determined | Component: | numeric |
Version: | Boost 1.50.0 | Severity: | Problem |
Keywords: | Cc: | antoshkka@… |
Description
When build with gcc -fno-exceptions, the compilation fails on the following oneliner:
#include <boost/numeric/conversion/converter.hpp>
That's because naked "throw" is used in that code. I believe it should use boost::throw_exception instead. I'm attaching a patch that implements this change.
Attachments (1)
Change History (7)
by , 11 years ago
Attachment: | boost-1.47.0-exceptions.patch added |
---|
comment:1 by , 11 years ago
Component: | None → numeric |
---|---|
Owner: | set to |
comment:2 by , 11 years ago
can somebody review this patch? the issue with kdeedu-rocs is still valid with 1.48
follow-up: 5 comment:3 by , 11 years ago
I looked at this and I don't like it.
I drags in a bunch of boost.exception stuff we're not using. This problem came up when BOOST_THROW_EXCEPTION was redefined by the authors of Boost Exception and surprised a lot of us with bloat code and other problems.
Think about this some more.
Robert Ramey
comment:4 by , 11 years ago
An exception is being thrown in header file. There's an existing tool for that in boost, boost::throw_exception. Many other (boost) libraries do it like that (though admittedly not all). It's a correctness issue, too, that code is invalid when compiled with -fno-exceptions. I don't think boost should support every odd compiler flag out there, but it seems that support for this one is well established.
comment:5 by , 11 years ago
Cc: | added |
---|---|
Version: | Boost 1.47.0 → Boost 1.50.0 |
Replying to ramey:
I looked at this and I don't like it.
I drags in a bunch of boost.exception stuff we're not using. This problem came up when BOOST_THROW_EXCEPTION was redefined by the authors of Boost Exception and surprised a lot of us with bloat code and other problems.
There is a patch for BOOST_THROW_EXCEPTION that reduces code bloat #6450
Support for noexception build is really required, because such builds are widely used on embedded platforms and are part of C++ corporate style in some organizations.
I would advise to use BOOST_THROW_EXCEPTION
instead of boost::throw_exception
, because it gives better control to user, better debugging abilities and is meant to be used in all libraries.
This is a very popular bug and a lot of users want it fixed! It is duplicated in tickets #5076, #5393, #5800.
Please, fix it till 1.50 release or allow me to fix it (it is a trivial bug).
Proposed fix