Damn me, the testcase is wrong of course. Sorry. Here is the real one:

testcase:

#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/locks.hpp>
using namespace boost;

static void foo()
{
    shared_mutex m;
    upgrade_lock<shared_mutex> lock(m);
    upgrade_to_unique_lock<shared_mutex> lock2(lock);
}

output:


D:\boost\include\boost-1_38/boost/thread/locks.hpp: In destructor 'boost::upgrade_to_unique_lock<Mutex>::~upgrade_to_unique_lock() [with Mutex = boost::shared_mutex]':
...   instantiated from here
D:\boost\include\boost-1_38/boost/thread/locks.hpp:807: error: no match for 'operator=' in '*((boost::upgrade_to_unique_lock<boost::shared_mutex>*)this)->boost::upgrade_to_unique_lock<boost::shared_mutex>::source = boost::move [with Mutex = boost::shared_mutex](((boost::unique_lock<boost::shared_mutex>&&)(&((boost::upgrade_to_unique_lock<boost::shared_mutex>*)this)->boost::upgrade_to_unique_lock<boost::shared_mutex>::exclusive)))'
D:\boost\include\boost-1_38/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]
D:\boost\include\boost-1_38/boost/thread/locks.hpp:694: note:                 boost::upgrade_lock<Mutex>& boost::upgrade_lock<Mutex>::operator=(boost::detail::thread_move_t<boost::upgrade_lock<Mutex> >) [with Mutex = boost::shared_mutex]
D:\boost\include\boost-1_38/boost/thread/locks.hpp:701: note:                 boost::upgrade_lock<Mutex>& boost::upgrade_lock<Mutex>::operator=(boost::detail::thread_move_t<boost::unique_lock<Mutex> >) [with Mutex = boost::shared_mutex]
D:\boost\include\boost-1_38/boost/thread/locks.hpp: In constructor 'boost::unique_lock<Mutex>::unique_lock(boost::upgrade_lock<Mutex>&&) [with Mutex = boost::shared_mutex]':
D:\boost\include\boost-1_38/boost/thread/locks.hpp:801:   instantiated from 'boost::upgrade_to_unique_lock<Mutex>::upgrade_to_unique_lock(boost::upgrade_lock<Mutex>&) [with Mutex = boost::shared_mutex]'
...  instantiated from here
D:\boost\include\boost-1_38/boost/thread/locks.hpp:775: error: request for member 'unlock_upgrade_and_lock' in '((boost::unique_lock<boost::shared_mutex>*)this)->boost::unique_lock<boost::shared_mutex>::m', which is of non-class type 'boost::shared_mutex*'


Von: Ein Held <mrhelt@yahoo.de>
An: threads-devel@lists.boost.org
Gesendet: Dienstag, den 17. Februar 2009, 22:42:11 Uhr
Betreff: [Threads-devel] upgrade_to_unique_lock broken on gcc 4.3.2 with c++0x mode enabled

boost::shared_lock seems to be broken on gcc 4.3.2 when the c++0x switch is set in the compiler's command line. Without the c++0x support the code compiles fine.

testcase:

#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/locks.hpp>
using namespace boost;

static void foo()
{
    upgrade_to_unique_lock<shared_mutex> lock;
}

output:

jobpool.hpp: In function 'void foo()':
jobpool.hpp:43: error: no matching function for call to 'boost::upgrade_to_unique_lock<boost::shared_mutex>::upgrade_to_unique_lock()'
D:\boost\include\boost-1_38/boost/thread/locks.hpp:811: note: candidates are: boost::upgrade_to_unique_lock<Mutex>::upgrade_to_unique_lock(boost::detail::thread_move_t<boost::upgrade_to_unique_lock<Mutex> >) [with Mutex = boost::shared_mutex]
D:\boost\include\boost-1_38/boost/thread/locks.hpp:800: note:                 boost::upgrade_to_unique_lock<Mutex>::upgrade_to_unique_lock(boost::upgrade_lock<Mutex>&) [with Mutex = boost::shared_mutex]
D:\boost\include\boost-1_38/boost/thread/locks.hpp:797: note:                 boost::upgrade_to_unique_lock<Mutex>::upgrade_to_unique_lock(boost::upgrade_to_unique_lock<Mutex>&) [with Mutex = boost::shared_mutex]