diff mbox series

Implement LWG 3062, Unnecessary decay_t in is_execution_policy_v

Message ID xkqeimv3f1os.fsf@trodgers.remote.f27
State New
Headers show
Series Implement LWG 3062, Unnecessary decay_t in is_execution_policy_v | expand

Commit Message

Thomas Rodgers April 24, 2019, 11:01 p.m. UTC
should be remove_cvref_t
	* include/pstl/execution_defs.h (__enable_if_execution_policy):
        Use std::__remove_cv_ref_t when building with GCC

Comments

Jonathan Wakely April 24, 2019, 11:08 p.m. UTC | #1
On 24/04/19 16:01 -0700, Thomas Rodgers wrote:
>
>	should be remove_cvref_t
>	* include/pstl/execution_defs.h (__enable_if_execution_policy):
>        Use std::__remove_cv_ref_t when building with GCC
>

>From cb7bd9a39acacbf81df0d03da8714fa463057cc5 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..9b9b212b1bd 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 __GNUC__

Clang and Intel both define that macro, but that doesn't mean
__remove_cvref_t is available. I think you want __GLIBCXX__ to tell
that libstdc++ is in use, or better still:

#if _GLIBCXX_RELEASE >= 9

>+using __enable_if_execution_policy =
>+    typename std::enable_if<__pstl::execution::is_execution_policy<typename std::__remove_cvref_t<_ExecPolicy>>::value,

The typename before std::__remove_cvref_t shouldn't be there.

>+                            _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
>-- 
>2.20.1
>
Thomas Rodgers April 25, 2019, 6:51 p.m. UTC | #2
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
Jonathan Wakely April 25, 2019, 6:59 p.m. UTC | #3
On 25/04/19 11:51 -0700, Thomas Rodgers wrote:
>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.

OK for trunk (but not for gcc-9-branch). Thanks.
Thomas Rodgers May 21, 2019, 10:18 p.m. UTC | #4
The revised attached patch has been ested x86_64-linux, committed to trunk.
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
diff mbox series

Patch

From cb7bd9a39acacbf81df0d03da8714fa463057cc5 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..9b9b212b1bd 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 __GNUC__
+using __enable_if_execution_policy =
+    typename std::enable_if<__pstl::execution::is_execution_policy<typename 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
-- 
2.20.1