Инструменты пользователя

Инструменты сайта


dev:cpp:boost:error:call_of_overloaded_move_boost:unique_lock_boost:shared_mutex

error: call of overloaded 'move(boost::unique_lock<boost::shared_mutex>&)' is ambiguous

Описание

boost 1.48 при сборке программы вываливается с ошибкой:

/usr/include/boost/thread/locks.hpp: In destructor 'boost::upgrade_to_unique_lock<Mutex>::~upgrade_to_unique_lock() [with Mutex = boost::shared_mutex]':
/projects/cpp/poker_prod/server_c/game/HallRoom.cpp:1442:53:   instantiated from here
/usr/include/boost/thread/locks.hpp:932:17: error: call of overloaded 'move(boost::unique_lock<boost::shared_mutex>&)' is ambiguous
/usr/include/boost/thread/locks.hpp:932:17: note: candidates are:
/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::unique_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::unique_lock<boost::shared_mutex> >]
/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::unique_lock<boost::shared_mutex>, typename boost::move_detail::disable_if<boost::has_move_emulation_enabled<T>, T&>::type = boost::unique_lock<boost::shared_mutex>&]

Решение

Однозначно - обновлять boost.

Псевдофикс

Следующий патч позволит собрать программу, но она будет потоко-не-безопасна.

--- a/locks.hpp	2011-12-05 12:26:11.650309054 +0400
+++ b/locks.hpp	2011-12-05 12:27:25.905311415 +0400
@@ -923,13 +923,13 @@
         upgrade_to_unique_lock& operator=(upgrade_to_unique_lock&);
     public:
         explicit upgrade_to_unique_lock(upgrade_lock<Mutex>& m_):
-            source(&m_),exclusive(move(*source))
+            source(&m_),exclusive(move(detail::thread_move_t<upgrade_lock<Mutex> >(*source)))
         {}
         ~upgrade_to_unique_lock()
         {
             if(source)
             {
-                *source=move(exclusive);
+                *source=move(detail::thread_move_t<unique_lock<Mutex> >(exclusive));
             }
         }
 

Информация

Ссылка на баг: Ticket #6141 (closed Bugs: fixed)

Дискуссия

Enter your comment
 
dev/cpp/boost/error/call_of_overloaded_move_boost/unique_lock_boost/shared_mutex.txt · Последние изменения: 19.02.2013 12:45 (внешнее изменение)

Инструменты страницы