This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Implement LWG 3062, Unnecessary decay_t in is_execution_policy_v
- From: Thomas Rodgers <trodgers at redhat dot com>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 21 May 2019 15:18:00 -0700
- Subject: Re: [PATCH] Implement LWG 3062, Unnecessary decay_t in is_execution_policy_v
- References: <xkqeimv3f1os.fsf@trodgers.remote.f27> <20190424230838.GR943@redhat.com> <xkqeh8algbp1.fsf@trodgers.remote.f27>
The revised attached patch has been ested x86_64-linux, committed to trunk.
>From 5f8aeeb98477d6555d65a45d1d2aed84b26863c9 Mon Sep 17 00:00:00 2001
From: Thomas Rodgers <trodgers@redhat.com>
Date: Tue, 21 May 2019 12:02:35 -0700
Subject: [PATCH] LWG 3062 - Unnecessary decay_t in is_execution_policy_v
* include/pstl/execution_defs.h (__enable_if_execution_policy):
Use std::__remove_cv_ref_t when building with GCC.
---
libstdc++-v3/ChangeLog | 6 ++++++
libstdc++-v3/include/pstl/execution_defs.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 804bace5e03..8ce445e39b8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-21 Thomas Rodgers <trodgers@redhat.com>
+
+ LWG 3062 - Unnecessary decay_t in is_execution_policy_v
+ * include/pstl/execution_defs.h (__enable_if_execution_policy):
+ Use std::__remove_cv_ref_t when building with GCC.
+
2019-05-21 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90252
diff --git a/libstdc++-v3/include/pstl/execution_defs.h b/libstdc++-v3/include/pstl/execution_defs.h
index 1a551c7871c..34b0e3d6350 100644
--- a/libstdc++-v3/include/pstl/execution_defs.h
+++ b/libstdc++-v3/include/pstl/execution_defs.h
@@ -152,9 +152,15 @@ constexpr bool is_execution_policy_v = __pstl::execution::is_execution_policy<_T
namespace __internal
{
template <class _ExecPolicy, class _Tp>
+#if _GLIBCXX_RELEASE >= 9
+using __enable_if_execution_policy =
+ typename std::enable_if<__pstl::execution::is_execution_policy<std::__remove_cvref_t<_ExecPolicy>>::value,
+ _Tp>::type;
+#else
using __enable_if_execution_policy =
typename std::enable_if<__pstl::execution::is_execution_policy<typename std::decay<_ExecPolicy>::type>::value,
_Tp>::type;
+#endif
} // namespace __internal
} // namespace __pstl
--
2.20.1
Thomas Rodgers writes:
> Revised patch.
>
> From 074685cf74b48604244c0c6f1d8cba63ff8915e5 Mon Sep 17 00:00:00 2001
> From: Thomas Rodgers <trodgers@redhat.com>
> Date: Wed, 24 Apr 2019 15:53:45 -0700
> Subject: [PATCH] Implement LWG 3062, Unnecessary decay_t in
> is_execution_policy_v
>
> should be remove_cvref_t
> * include/pstl/execution_defs.h (__enable_if_execution_policy):
> Use std::__remove_cv_ref_t when building with GCC.
> ---
> libstdc++-v3/include/pstl/execution_defs.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/libstdc++-v3/include/pstl/execution_defs.h b/libstdc++-v3/include/pstl/execution_defs.h
> index 86c7a5a770d..0ed4cc30914 100644
> --- a/libstdc++-v3/include/pstl/execution_defs.h
> +++ b/libstdc++-v3/include/pstl/execution_defs.h
> @@ -152,9 +152,15 @@ constexpr bool is_execution_policy_v = __pstl::execution::is_execution_policy<_T
> namespace __internal
> {
> template <class _ExecPolicy, class _T>
> +#if _GLIBCXX_RELEASE >= 9
> +using __enable_if_execution_policy =
> + typename std::enable_if<__pstl::execution::is_execution_policy<std::__remove_cvref_t<_ExecPolicy>>::value,
> + _T>::type;
> +#else
> using __enable_if_execution_policy =
> typename std::enable_if<__pstl::execution::is_execution_policy<typename std::decay<_ExecPolicy>::type>::value,
> _T>::type;
> +#endif
> } // namespace __internal
>
> } // namespace __pstl