Opened 13 years ago

Closed 13 years ago

#3995 closed Patches (fixed)

array breaks with BOOST_NO_EXCEPTIONS and BOOST_EXCEPTION_DISABLE

Reported by: peter.myerscough-jackopson@… Owned by: Marshall Clow
Milestone: Boost 1.43.0 Component: array
Version: Boost 1.42.0 Severity: Problem
Keywords: array BOOST_NO_EXCEPTIONS BOOST_EXCEPTION_DISABLE Cc:

Description

I am using boost in the TI Code composer studio environment for an embedded platform which is does not support exceptions. I have therefore had to define BOOST_NO_EXCEPTIONS and BOOST_EXCEPTION_DISABLE to compile with boost::array, BUT I have also had to fix a bug in the use of exceptions.

On line 171 in array.hpp there is a std::out_of_range exception thrown using the throw statement. This causes an error due to exceptions not being defined.

Further down in the partial specialisation for zero sized arrays, on lines 285-286 another exception is created and thrown using boost::throw_exception. This does not cause an error. The patch therefore is to allow boost::array to be compiled without errors with exceptions disabled.

-171                throw std::out_of_range("array<>: index out of range");
+171                std::out_of_range e("array<>: index out of range");
+172                boost::throw_exception(e);

It may be more useful to consider putting #ifdef BOOST_NO_EXCEPTIONS around rangecheck(...) to ensure that the function does not get called with BOOST_NO_EXCEPTION, because it will not have any effect.

Ps. should I have to be defining BOOST_EXCEPTION_DISABLE??

Change History (4)

comment:1 by anonymous, 13 years ago

Component: Nonearray
Keywords: array BOOST_NO_EXCEPTIONS BOOST_EXCEPTION_DISABLE added
Owner: set to No-Maintainer
Type: BugsPatches

comment:2 by Marshall Clow, 13 years ago

Owner: changed from No-Maintainer to Marshall Clow

I have updated the trunk as of revision #60417. After the tests have cycled a few times, I will merge to the release branch.

comment:3 by Marshall Clow, 13 years ago

Status: newassigned

comment:4 by Marshall Clow, 13 years ago

Resolution: fixed
Status: assignedclosed

Migrated to release branch in revision 60824

Note: See TracTickets for help on using tickets.