Opened 9 years ago

Closed 9 years ago

#9096 closed Bugs (fixed)

local_time.hpp won't compile with BOOST_NO_EXCEPTIONS

Reported by: Alex Henrie <alexhenrie24@…> Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.49.0 Severity: Showstopper
Keywords: Cc: emildotchevski@…

Description

I have a project that is compiled with -fno-exceptions and -DBOOST_NO_EXCEPTIONS, but I get a compilation error when I try to use Boost's date/time library. To reproduce the error, just say:

#include <boost/date_time/local_time/local_time.hpp>

The error is:

/usr/include/boost/numeric/conversion/converter_policies.hpp:162: error: exception handling disabled, use -fexceptions to enable

And the offending code in converter_policies.hpp is:

struct def_overflow_handler
{
  void operator() ( range_check_result r ) // throw(negative_overflow,positive_overflow)
  {
    if ( r == cNegOverflow )
      throw negative_overflow() ;
    else if ( r == cPosOverflow )
           throw positive_overflow() ;
  }
} ;

According to http://boost.2283326.n4.nabble.com/no-exceptions-td3395091.html, BOOST_NO_EXCEPTIONS is actively supported and exceptions are always supposed to go through BOOST_THROW_EXCEPTION or boost::throw_exception to avoid compilation errors like this one.

Change History (2)

comment:1 by Marshall Clow, 9 years ago

Component: numericdate_time
Owner: changed from Douglas Gregor to az_sw_dude

comment:2 by Marshall Clow, 9 years ago

Resolution: fixed
Status: newclosed

This appears to have been fixed in [77234] back in March of this year, and merged to the release branch in [77288]

I believe that this change was part of 1.54.0.

Note: See TracTickets for help on using tickets.