aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/include/__functional/invoke.h
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-04-26 15:33:29 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-05-08 19:37:29 -0700
commit06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76 (patch)
tree1316711b92a43dd5c599e425b8693fa8e1e0c0b7 /lib/libcxx/include/__functional/invoke.h
parentbc6ebc6f2597fda1f98842c6f545751fef2a5334 (diff)
downloadzig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.tar.gz
zig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.zip
libcxx: update to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42 This adds the flag `-D_LIBCPP_HARDENING_MODE` which is determined based on the Zig optimization mode. This commit also fixes libunwind, libcxx, and libcxxabi to properly report sub compilation errors.
Diffstat (limited to 'lib/libcxx/include/__functional/invoke.h')
-rw-r--r--lib/libcxx/include/__functional/invoke.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/libcxx/include/__functional/invoke.h b/lib/libcxx/include/__functional/invoke.h
index a7dd311074..ef4bf25f07 100644
--- a/lib/libcxx/include/__functional/invoke.h
+++ b/lib/libcxx/include/__functional/invoke.h
@@ -22,12 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Fn, class ..._Args>
+template <class _Fn, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...>
-invoke(_Fn&& __f, _Args&&... __args)
- noexcept(is_nothrow_invocable_v<_Fn, _Args...>)
-{
- return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
+invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) {
+ return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 17
@@ -37,17 +35,17 @@ template <class _Result, class _Fn, class... _Args>
requires is_invocable_r_v<_Result, _Fn, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr _Result
invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) {
- if constexpr (is_void_v<_Result>) {
- static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
- } else {
- // TODO: Use reference_converts_from_temporary_v once implemented
- // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
- // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
- static_assert(true,
- "Returning from invoke_r would bind a temporary object to the reference return type, "
- "which would result in a dangling reference.");
- return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
- }
+ if constexpr (is_void_v<_Result>) {
+ static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
+ } else {
+ // TODO: Use reference_converts_from_temporary_v once implemented
+ // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
+ // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
+ static_assert(true,
+ "Returning from invoke_r would bind a temporary object to the reference return type, "
+ "which would result in a dangling reference.");
+ return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
+ }
}
#endif