[2/2] libstdc++: use new built-in trait __is_array

Message ID 20230321223957.7176-2-kmatsui@cs.washington.edu
State Superseded
Headers
Series [1/2] c++: implement __is_array built-in trait |

Commit Message

Ken Matsui March 21, 2023, 10:39 p.m. UTC
  This patch lets libstdc++ use new built-in trait __is_array.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_array): Use __is_array built-in trait.
---
 libstdc++-v3/include/std/type_traits | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 2bd607a8b8f..a9b1a6eb62a 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -503,6 +503,12 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
 
   /// is_array
+#if __has_builtin(__is_array)
+  template<typename _Tp>
+    struct is_array
+    : public __bool_constant<__is_array(_Tp)>
+    { };
+#else
   template<typename>
     struct is_array
     : public false_type { };
@@ -514,6 +520,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp>
     struct is_array<_Tp[]>
     : public true_type { };
+#endif
 
   template<typename>
     struct __is_pointer_helper