The following code doesn't compile with gcc-4.3.2 (and gcc-4.4.0), and
boost-1.36 (and boost-trunk of 2008/10/07) when using -std=c++0x on linux.
#include
int main()
{
boost::shared_mutex mtx;
boost::upgrade_lockboost::shared_mutex lk(mtx);
boost::upgrade_to_unique_lockboost::shared_mutex lk2(lk);
}
gcc spits:
g++-4.4.0-alpha20081003 -std=c++0x -I src/boost-trunk teste.cpp -o teste
In file included from src/boost-trunk/boost/thread/pthread/mutex.hpp:11,
from src/boost-trunk/boost/thread/mutex.hpp:16,
from
src/boost-trunk/boost/thread/pthread/shared_mutex.hpp:12,
from src/boost-trunk/boost/thread/shared_mutex.hpp:16,
from teste.cpp:1:
src/boost-trunk/boost/thread/locks.hpp: In destructor
'boost::upgrade_to_unique_lock<Mutex>::~upgrade_to_unique_lock() [with
Mutex = boost::shared_mutex]':
teste.cpp:8: instantiated from here
src/boost-trunk/boost/thread/locks.hpp:807: error: no match for
'operator=' in
'*((boost::upgrade_to_unique_lockboost::shared_mutex*)this)->boost::upgrade_to_unique_lockboost::shared_mutex::source
= boost::move [with Mutex =
boost::shared_mutex](((boost::unique_lockboost::shared_mutex&&)(&((boost::upgrade_to_unique_lockboost::shared_mutex*)this)->boost::upgrade_to_unique_lockboost::shared_mutex::exclusive)))'
src/boost-trunk/boost/thread/locks.hpp:643: note: candidates are:
boost::upgrade_lock<Mutex>&
boost::upgrade_lock<Mutex>::operator=(boost::upgrade_lock<Mutex>&) [with
Mutex = boost::shared_mutex]
src/boost-trunk/boost/thread/locks.hpp:694: note:
boost::upgrade_lock<Mutex>&
boost::upgrade_lock<Mutex>::operator=(boost::detail::thread_move_t
) [with Mutex = boost::shared_mutex]
src/boost-trunk/boost/thread/locks.hpp:701: note:
boost::upgrade_lock<Mutex>&
boost::upgrade_lock<Mutex>::operator=(boost::detail::thread_move_tboost::shared_mutex*)this)->boost::unique_lockboost::shared_mutex::m',
which is of non-class type 'boost::shared_mutex*'
It compiles fine in non std++0x mode
Regards,
Rodolfo Lima