lock_guard_adopt_lock_compile_fail.cpp 523 B

123456789101112131415161718192021
  1. // Copyright (C) 2018 Tom Hughes
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // <boost/thread/lock_guard.hpp>
  6. // template <class Mutex> class lock_guard;
  7. // lock_guard(Mutex& m_, adopt_lock_t)
  8. #include <boost/thread/lock_guard.hpp>
  9. #include <boost/thread/mutex.hpp>
  10. #include <boost/detail/lightweight_test.hpp>
  11. boost::mutex m;
  12. void fail()
  13. {
  14. boost::lock_guard<boost::mutex> lk(m, boost::adopt_lock);
  15. }