[PATCH] D31163: Implement Pp0156r2 "Variadic Lock Guard, version 5"

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 16:29:12 PDT 2017


mclow.lists added inline comments.


================
Comment at: include/mutex:176
 
+template<class M> unique_lock(unique_lock<M>)
+    -> unique_lock<M>; // C++17
----------------
EricWF wrote:
> This should be guarded behind a feature test macro. I would suggest adding this to `__config`.
> 
> ```
> #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
> # define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
> #endif
> ```
That sounds right to me.


================
Comment at: include/mutex:177
+template<class M> unique_lock(unique_lock<M>)
+    -> unique_lock<M>; // C++17
+
----------------
And what's with the 'M'?  (here and below)


================
Comment at: test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp:99
+
+#if TEST_STD_VER > 14
+	std::shared_lock sl(m);	// deduction guide
----------------
EricWF wrote:
> The tests for deduction guides should `static_assert(std::is_same_v<decltype(sl), Expected>);`.
Agreed.


https://reviews.llvm.org/D31163





More information about the cfe-commits mailing list