Boost C++ Libraries: Ticket #7118: Condition.Wait with a mutex instead of lock can be mysterious https://svn.boost.org/trac10/ticket/7118 <p> This code correctly fails to compile: #include &lt;boost/interprocess/sync/named_condition.hpp&gt; #include &lt;boost/interprocess/sync/named_mutex.hpp&gt; </p> <p> int _tmain(int argc, _TCHAR* argv[]) { </p> <blockquote> <p> boost::interprocess::named_mutex mutex( boost::interprocess::open_or_create, "test" ); boost::interprocess::named_condition condition( boost::interprocess::open_or_create, "test" ); condition.wait( mutex ); return 0; </p> </blockquote> <p> } </p> <p> The resulting compile error (at least on VC++ 2010) is a tad mysterious: </p> <p> 1&gt;c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(204): error C2248: 'boost::interprocess::interprocess_mutex::mutex' : cannot access private member declared in class 'boost::interprocess::interprocess_mutex' 1&gt; c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\interprocess_mutex.hpp(117) : see declaration of 'boost::interprocess::interprocess_mutex::mutex' 1&gt; c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\interprocess_mutex.hpp(67) : see declaration of 'boost::interprocess::interprocess_mutex' 1&gt; c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(204) : while compiling class template member function 'boost::interprocess::ipcdetail::shm_named_condition::lock_wrapper&lt;Lock&gt;::mutex_type *boost::interprocess::ipcdetail::shm_named_condition::lock_wrapper&lt;Lock&gt;::mutex(void) const' 1&gt; with 1&gt; [ 1&gt; Lock=boost::interprocess::named_mutex 1&gt; ] 1&gt; c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(342) : see reference to class template instantiation 'boost::interprocess::ipcdetail::shm_named_condition::lock_wrapper&lt;Lock&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Lock=boost::interprocess::named_mutex 1&gt; ] 1&gt; c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\named_condition.hpp(156) : see reference to function template instantiation 'void boost::interprocess::ipcdetail::shm_named_condition::wait&lt;L&gt;(L &amp;)' being compiled 1&gt; with 1&gt; [ 1&gt; L=boost::interprocess::named_mutex 1&gt; ] 1&gt; c:\code\projects\testinterprocess\testinterprocess\testinterprocess.cpp(10) : see reference to function template instantiation 'void boost::interprocess::named_condition::wait&lt;boost::interprocess::named_mutex&gt;(L &amp;)' being compiled 1&gt; with 1&gt; [ 1&gt; L=boost::interprocess::named_mutex 1&gt; ] 1&gt;c:\code\sdks\boost\include\boost-1_50\boost\interprocess\sync\shm\named_condition.hpp(204): error C2064: term does not evaluate to a function taking 0 arguments </p> <p> It is not obvious that the problem involves the use of a Mutex instead of a <a class="missing wiki">ScopedLock</a> or the like. While the example code makes this clear, if you examine only the documentation, this detail might be confusing. </p> <p> Recommend adding a concept check to help guide someone towards using a lock instead of a mutex. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7118 Trac 1.4.3