EricWF added a comment.

So Clang only very recently added support for deduction guides. We'll need to 
add `_LIBCPP_HAS_NO_DEDUCTION_GUIDES` and use it to guard the declarations and 
the tests.

Also I think the explicit deduction guides are incorrect and unneeded. The 
deduction guides you declare are `template <class Mutex> 
unique_lock(unique_lock<Mutex>) -> unique_lock<Mutex>` but no such constructor 
exists. I suspect the intent was to support deduction for the 
`unique_lock(mutex_type)` constructor but that already works implicitly.



================
Comment at: include/mutex:176
 
+template<class M> unique_lock(unique_lock<M>)
+    -> unique_lock<M>; // C++17
----------------
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
```


================
Comment at: include/mutex:705
 
-#endif // _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+template<class... _Mutexes> scoped_lock(scoped_lock<_Mutexes...>)
+  -> scoped_lock<_Mutexes...>;
----------------
This should be guarded as well.


================
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
----------------
The tests for deduction guides should 
`static_assert(std::is_same_v<decltype(sl), Expected>);`.


================
Comment at: 
test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp:57
+#if TEST_STD_VER > 14
+       std::unique_lock ul(m); // deduction guide
+#endif
----------------
The tests for deduction guides should 
`static_assert(std::is_same_v<decltype(sl), Expected>);`.



https://reviews.llvm.org/D31163



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to