Opened 14 years ago

Closed 13 years ago

#2947 closed Bugs (fixed)

serialization/throw_exception.hpp uses BOOST_NO_EXCEPTIONS in the wrong way

Reported by: apaku@… Owned by: Robert Ramey
Milestone: Boost 1.39.0 Component: serialization
Version: Boost 1.37.0 Severity: Problem
Keywords: Cc:

Description

Using boost multi_index in a project that doesn't supply -fexceptions (or rather that supplies -fno-exceptions) to the compiler fails at linking time because there's an undefined reference to boost::throw_exception(std::exception). This appears to be caused by the #ifdef stuff in serialization/throw_exception.hpp, which uses std::exception if BOOST_NO_EXCEPTIONS is defined. However this define is set when exception support is turned off.

Hence instead of "#ifdef BOOST_NO_EXCEPTIONS" this should probably be "#ifndef BOOST_NO_EXCEPTIONS". Changing the header file accordingly makes the project I have here link properly.

First version that breaks is 1.37, in 1.36 the problem doesn't appear.

Change History (3)

comment:1 by Vladimir Prus, 14 years ago

The actual problem is that:

  1. in BOOST_NO_EXCEPTIONS the boost::serialization::throw_exception functions lacks 'inline'
  2. in BOOST_NO_EXCEPTIONS case <exception> is included -- and it should not.

comment:2 by Marshall Clow, 13 years ago

Component: Noneserialization
Owner: set to Robert Ramey

comment:3 by Vladimir Prus, 13 years ago

Resolution: fixed
Status: newclosed

I have merged the fix to release branch. It will be available in 1.40.0. It might be available in 1.39.1, if we do it. Andreas, this fixes the duplicate boost::serialization::throw_exception. You still will have to define boost::throw exception with appropriate behaviour.

Note: See TracTickets for help on using tickets.