[v2] libstdc++: use __is_enum built-in trait

Message ID 20230708045005.61988-1-kmatsui@gcc.gnu.org
State Accepted
Headers
Series [v2] libstdc++: use __is_enum built-in trait |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Ken Matsui July 8, 2023, 4:50 a.m. UTC
  This patch replaces is_enum<T>::value with __is_enum built-in trait in
the type_traits header.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__make_unsigned_selector): Use
	__is_enum built-in trait.
	(__make_signed_selector): Likewise.
	(__underlying_type_impl): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Jonathan Wakely July 12, 2023, 9:51 a.m. UTC | #1
On Sat, 8 Jul 2023 at 05:50, Ken Matsui via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> This patch replaces is_enum<T>::value with __is_enum built-in trait in
> the type_traits header.
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (__make_unsigned_selector): Use
>         __is_enum built-in trait.
>         (__make_signed_selector): Likewise.
>         (__underlying_type_impl): Likewise.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>

OK for trunk, thanks!


> ---
>  libstdc++-v3/include/std/type_traits | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index 0e7a9c9c7f3..9f086992ebc 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -1740,7 +1740,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    // Select between integral and enum: not possible to be both.
>    template<typename _Tp,
>            bool _IsInt = is_integral<_Tp>::value,
> -          bool _IsEnum = is_enum<_Tp>::value>
> +          bool _IsEnum = __is_enum(_Tp)>
>      class __make_unsigned_selector;
>
>    template<typename _Tp>
> @@ -1900,7 +1900,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    // Select between integral and enum: not possible to be both.
>    template<typename _Tp,
>            bool _IsInt = is_integral<_Tp>::value,
> -          bool _IsEnum = is_enum<_Tp>::value>
> +          bool _IsEnum = __is_enum(_Tp)>
>      class __make_signed_selector;
>
>    template<typename _Tp>
> @@ -2353,7 +2353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      struct __common_type_fold<_CTp, _Rp, void>
>      { };
>
> -  template<typename _Tp, bool = is_enum<_Tp>::value>
> +  template<typename _Tp, bool = __is_enum(_Tp)>
>      struct __underlying_type_impl
>      {
>        using type = __underlying_type(_Tp);
> --
> 2.41.0
>
  

Patch

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 0e7a9c9c7f3..9f086992ebc 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1740,7 +1740,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Select between integral and enum: not possible to be both.
   template<typename _Tp,
 	   bool _IsInt = is_integral<_Tp>::value,
-	   bool _IsEnum = is_enum<_Tp>::value>
+	   bool _IsEnum = __is_enum(_Tp)>
     class __make_unsigned_selector;
 
   template<typename _Tp>
@@ -1900,7 +1900,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Select between integral and enum: not possible to be both.
   template<typename _Tp,
 	   bool _IsInt = is_integral<_Tp>::value,
-	   bool _IsEnum = is_enum<_Tp>::value>
+	   bool _IsEnum = __is_enum(_Tp)>
     class __make_signed_selector;
 
   template<typename _Tp>
@@ -2353,7 +2353,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct __common_type_fold<_CTp, _Rp, void>
     { };
 
-  template<typename _Tp, bool = is_enum<_Tp>::value>
+  template<typename _Tp, bool = __is_enum(_Tp)>
     struct __underlying_type_impl
     {
       using type = __underlying_type(_Tp);