Opened 6 years ago

Closed 5 years ago

#12874 closed Patches (fixed)

future<> extension constructor must be under BOOST_THREAD_PROVIDES_FUTURE_UNWRAP

Reported by: Arthur O'Dwyer Owned by: viboes
Milestone: Boost 1.65.0 Component: thread
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc:

Description

In Boost 1.63.0's "boost/thread/future.hpp", we see this code:

    inline explicit BOOST_THREAD_FUTURE(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE<BOOST_THREAD_FUTURE<R> >) other); // EXTENSION

Unfortunately, the actual definition of this inline constructor is located under an #ifdef that may not be defined at compile time:

#if defined BOOST_THREAD_PROVIDES_FUTURE_UNWRAP
// many lines snipped...
  template <typename R>
  inline BOOST_THREAD_FUTURE<R>::BOOST_THREAD_FUTURE(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE<BOOST_THREAD_FUTURE<R> >) other)
  : base_type(other.unwrap()) {}
// several lines snipped...
#endif

The result is that this inline constructor is declared but not defined, which produces very confusing linker errors.

The appropriate solution is to wrap the declaration of this constructor in

#if defined BOOST_THREAD_PROVIDES_FUTURE_UNWRAP
#endif

No other change needs to be made, as far as I know.

Change History (3)

comment:1 by viboes, 5 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:3 by viboes, 5 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.