[libcxx] r304955 - Fix class template deduction for scoped_lock.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 17:38:56 PDT 2017


Author: ericwf
Date: Wed Jun  7 19:38:56 2017
New Revision: 304955

URL: http://llvm.org/viewvc/llvm-project?rev=304955&view=rev
Log:
Fix class template deduction for scoped_lock.

r304862 changed how CTD handles deducing a non-primary class template
using a non-dependent constructor of the primary template. This change
requires libc++ to provide explicit deduction guides to make scoped_lock
work again.

Modified:
    libcxx/trunk/include/mutex

Modified: libcxx/trunk/include/mutex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=304955&r1=304954&r2=304955&view=diff
==============================================================================
--- libcxx/trunk/include/mutex (original)
+++ libcxx/trunk/include/mutex Wed Jun  7 19:38:56 2017
@@ -502,7 +502,6 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
         : __m_(__m) {}
-    
 
     scoped_lock(scoped_lock const&) = delete;
     scoped_lock& operator=(scoped_lock const&) = delete;
@@ -547,6 +546,11 @@ private:
     _MutexTuple __t_;
 };
 
+#ifdef __cpp_deduction_guides
+template <class _Mutex> explicit scoped_lock(_Mutex&) -> scoped_lock<_Mutex>;
+explicit scoped_lock() -> scoped_lock<>;
+#endif
+
 #endif // _LIBCPP_STD_VER > 14
 #endif // !_LIBCPP_HAS_NO_THREADS
 




More information about the cfe-commits mailing list