Opened 11 years ago
Closed 11 years ago
#6170 closed Bugs (duplicate)
boost::move conflicts in thread upgrade mutexes (1.48.0)
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.48.0 | Severity: | Regression |
Keywords: | Cc: | viboes |
Description
Due to the new boost::move package, you can no longer use upgradeable locks and unordered_map at the same time, you get ambiguous function names:
Compiling the file:
#include <boost/thread/shared_mutex.hpp> #include <boost/thread/locks.hpp> // Including this will cause ambiguous errors in boost::move #include <boost/unordered_map.hpp> using namespace boost; typedef upgrade_lock<shared_mutex> auto_upgrade_lock; typedef upgrade_to_unique_lock<shared_mutex> auto_upgrade_unique_lock; void testUpgrade(void); void testUpgrade(void) { shared_mutex mtx; auto_upgrade_lock lock(mtx); // Do some read-only stuff auto_upgrade_unique_lock writeLock(lock); // Do some write-only stuff with the upgraded lock }
Yields the following error:
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]’: test.cpp:23: instantiated from here boost/thread/locks.hpp:926: error: call of overloaded ‘move(boost::upgrade_lock<boost::shared_mutex>&)’ is ambiguous boost/thread/detail/move.hpp:44: note: candidates are: 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>] boost/move/move.hpp:294: 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>] boost/thread/locks.hpp: In destructor ‘boost::upgrade_to_unique_lock<Mutex>::~upgrade_to_unique_lock() [with Mutex = boost::shared_mutex]’: test.cpp:23: instantiated from here boost/thread/locks.hpp:932: error: call of overloaded ‘move(boost::unique_lock<boost::shared_mutex>&)’ is ambiguous boost/thread/detail/move.hpp:44: note: candidates are: 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::unique_lock<boost::shared_mutex>] boost/move/move.hpp:294: note: typename boost::move_detail::disable_if<boost::has_move_emulation_enabled<T>, T&>::type boost::move(T&) [with T = boost::unique_lock<boost::shared_mutex>]
Compiling using 1.48.0 on OSX.
Change History (3)
comment:1 by , 11 years ago
comment:3 by , 11 years ago
Cc: | added |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Duplicate of #6141 Compilation error when boost.thread and boost.move are used together
Note:
See TracTickets
for help on using tickets.
It is similar to the #6141 ticket.