[Boost-bugs] [Boost C++ Libraries] #6207: shared_lock swap compiler error on clang 3.0 c++11

Subject: [Boost-bugs] [Boost C++ Libraries] #6207: shared_lock swap compiler error on clang 3.0 c++11
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-04 14:42:50


#6207: shared_lock swap compiler error on clang 3.0 c++11
--------------------------+-------------------------------------------------
 Reporter: viboes | Owner: viboes
     Type: Bugs | Status: new
Milestone: Boost 1.49.0 | Component: None
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: swap |
--------------------------+-------------------------------------------------
 While runing the regression test on clang-3.0/2.9 c++11 the following
 compile error appears

 {{{
 clang-darwin.compile.c++
 ../../../bin.v2/libs/thread/test/test_lock_concept.test/clang-
 darwin-2.9x/debug/threading-multi/test_lock_concept.o
 In file included from test_lock_concept.cpp:6:
 In file included from ../../../boost/test/unit_test.hpp:19:
 In file included from ../../../boost/test/test_tools.hpp:20:
 In file included from ../../../boost/test/unit_test_log.hpp:21:
 In file included from ../../../boost/test/tree/observer.hpp:20:
 In file included from ../../../boost/test/detail/global_typedef.hpp:18:
 In file included from
 ../../../boost/test/utils/basic_cstring/basic_cstring.hpp:21:
 In file included from
 ../../../boost/test/utils/basic_cstring/bcs_char_traits.hpp:25:
 In file included from /usr/include/c++/4.2.1/string:46:
 In file included from /usr/include/c++/4.2.1/bits/char_traits.h:45:
 /usr/include/c++/4.2.1/bits/stl_algobase.h:99:11: error: 'operator=' is a
 private member of 'boost::shared_lock<boost::shared_mutex>'
       __a = __b;
       ~~~ ^ ~~~
 In file included from test_lock_concept.cpp:6:
 In file included from ../../../boost/test/unit_test.hpp:20:
 In file included from ../../../boost/test/unit_test_suite.hpp:21:
 In file included from ../../../boost/test/tree/test_case_template.hpp:31:
 In file included from ../../../boost/mpl/for_each.hpp:28:
 In file included from ../../../boost/utility/value_init.hpp:30:
 In file included from ../../../boost/swap.hpp:10:
 ../../../boost/utility/swap.hpp:33:5: note: in instantiation of function
 template specialization 'std::swap<boost::shared_lock<boost::shared_mutex>
>' requested here
     swap(left,right);
     ^
 ../../../boost/utility/swap.hpp:51:5: note: in instantiation of function
 template specialization
 'boost_swap_impl::swap_impl<boost::shared_lock<boost::shared_mutex> >'
 requested here
     ::boost_swap_impl::swap_impl(left, right);
     ^
 test_lock_concept.cpp:394:9: note: in instantiation of function template
 specialization 'boost::swap<boost::shared_lock<boost::shared_mutex>,
 boost::shared_lock<boost::shared_mutex> >' requested here
         swap(l1,l2);
         ^
 test_lock_concept.cpp:535:44: note: in instantiation of member function
 'test_locks_can_be_swapped<boost::shared_mutex,
 boost::shared_lock<boost::shared_mutex> >::operator()' requested here
     test_locks_can_be_swapped<Mutex,Lock>()();

 }}}


 I think the problem comes from this declaration:

 #ifndef BOOST_NO_RVALUE_REFERENCES
     template<typename Mutex>
     void swap(shared_lock<Mutex>&& lhs,shared_lock<Mutex>&& rhs)
     {
         lhs.swap(rhs);
     }
 #else
     template<typename Mutex>
     void swap(shared_lock<Mutex>& lhs,shared_lock<Mutex>& rhs)
     {
         lhs.swap(rhs);
     }
 #endif

 As I suspect that the overloading is not working. BTW, all the working
 swap overloads use the non moving interface.

 When I use instead

     template<typename Mutex>
     void swap(shared_lock<Mutex>& lhs,shared_lock<Mutex>& rhs)
     {
         lhs.swap(rhs);
     }

 the test works.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6207>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC