[libcxx-commits] [libcxx] [libc++] Implement LWG3476: Add mandates to thread, jthread, and async (PR #173363)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 23 03:54:58 PST 2025


================
@@ -205,6 +207,12 @@ class _LIBCPP_EXPORTED_FROM_ABI thread {
 #  ifndef _LIBCPP_CXX03_LANG
   template <class _Fp, class... _Args, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value, int> = 0>
   _LIBCPP_HIDE_FROM_ABI explicit thread(_Fp&& __f, _Args&&... __args) {
+#    if _LIBCPP_STD_VER >= 17
+    static_assert(is_constructible_v<__decay_t<_Fp>, _Fp>);
+    static_assert((is_constructible_v<__decay_t<_Args>, _Args> && ...));
+    static_assert(is_invocable_v<__decay_t<_Fp>, __decay_t<_Args>...>);
+#    endif
----------------
frederick-vs-ja wrote:

I think we should add these in C++11/14. We can use `is_constructible<...>::value` and `__is_invocable_v`.

https://github.com/llvm/llvm-project/pull/173363


More information about the libcxx-commits mailing list