0

I'm writing an app using Boost.Thread. Unfortunatelly, after moving new version to the 'production' environment I can't compile the project. g++ says:

/usr/include/boost/thread/locks.hpp: In constructor 
    ‘boost::upgrade_to_unique_lock<Mutex>::upgrade_to_unique_lock
    (boost::upgrade_lock<Mutex>&) [with Mutex = boost::shared_mutex]’:
worker.cpp:34:69: instantiated from here
/usr/include/boost/thread/locks.hpp:926:48: error: call of overloaded ‘move(
    boost::upgrade_lock<boost::shared_mutex>&)’ is ambiguous
/usr/include/boost/thread/locks.hpp:926:48: note: candidates are:
/usr/include/boost/move/move.hpp:294:86: note: typename boost::move_detail
    ::disable_if<boost::has_move_emulation_enabled<T>, T&>::type boost::move(T&)
    [with T = boost::upgrade_lock<boost::shared_mutex>, typename boost::move_detail
    ::disable_if<boost::has_move_emulation_enabled<T>, T&>::type = boost
    ::upgrade_lock<boost::shared_mutex>&]
/usr/include/boost/thread/detail/move.hpp:44:110: note: typename boost
    ::enable_if<boost::is_convertible<T&, boost::detail::thread_move_t<T> >,
    boost::detail::thread_move_t<T> >::type boost::move(T&) [with T = boost
    ::upgrade_lock<boost::shared_mutex>, typename boost::enable_if<boost
    ::is_convertible<T&, boost::detail::thread_move_t<T> >, boost::detail
    ::thread_move_t<T> >::type = boost::detail::thread_move_t<boost
    ::upgrade_lock<boost::shared_mutex> >]
/usr/include/boost/thread/locks.hpp: In destructor ‘boost::upgrade_to_unique_lock
    <Mutex>::~upgrade_to_unique_lock() [with Mutex = boost::shared_mutex]’:
worker.cpp:34:69: instantiated from here
/usr/include/boost/thread/locks.hpp:932:17: error: call of overloaded ‘move(boost
    ::unique_lock<boost::shared_mutex>&)’ is ambiguous
...

and so on and so forth.

I checked that dev and production environment have same libboost version (1.48).

Does anyone know what can be a reason? Which other libs/tools versions should i check/upgrade?

warran
  • 184
  • 1
  • 10

1 Answers1

1

This is a known bug in Boost 1.48 that appears to have been fixed in 1.49 according to their bug tracker. There is an ambiguity if Boost.Move, which emulates C++11 move semantics, is used with Boost.Thread, which comes with its own move semantics emulators.

Considering that Boost 1.48 was released more than 2.5 years ago (in November 2011), you should consider upgrading to the newest release, which is currently Boost 1.55.

T.C.
  • 133,968
  • 17
  • 288
  • 421