diff mbox series

[3/4] libstdc++: Remove std::__is_void class template [PR115497]

Message ID 20240620153240.2022128-3-jwakely@redhat.com
State New
Headers show
Series [1/4] libstdc++: Don't use std::__is_scalar in std::valarray initialization [PR115497] | expand

Commit Message

Jonathan Wakely June 20, 2024, 3:30 p.m. UTC
Tested x86_64-linux.

-- >8 --

This removes the std::__is_void trait, as it conflicts with a Clang
built-in. There is only one use of the trait, which can easily be
replaced by simpler code.

Although Clang has a hack to make the class template work despite using
a reserved name, removing std::__is_void will allow that hack to be
dropped at some future date.

libstdc++-v3/ChangeLog:

	PR libstdc++/115497
	* include/bits/cpp_type_traits.h (__is_void): Remove.
	* include/debug/helper_functions.h (_Distance_traits):
	Adjust partial specialization to match void directly, instead of
	using __is_void<T>::__type and matching __true_type.
---
 libstdc++-v3/include/bits/cpp_type_traits.h   | 15 ---------------
 libstdc++-v3/include/debug/helper_functions.h |  5 ++---
 2 files changed, 2 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index 6834dee5557..4d83b9472e6 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -105,21 +105,6 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       typedef __true_type __type;
     };
 
-  // Holds if the template-argument is a void type.
-  template<typename _Tp>
-    struct __is_void
-    {
-      enum { __value = 0 };
-      typedef __false_type __type;
-    };
-
-  template<>
-    struct __is_void<void>
-    {
-      enum { __value = 1 };
-      typedef __true_type __type;
-    };
-
   //
   // Integer types
   //
diff --git a/libstdc++-v3/include/debug/helper_functions.h b/libstdc++-v3/include/debug/helper_functions.h
index 5474399dc67..d686a29e8ee 100644
--- a/libstdc++-v3/include/debug/helper_functions.h
+++ b/libstdc++-v3/include/debug/helper_functions.h
@@ -66,13 +66,12 @@  namespace __gnu_debug
       typedef
 	typename std::iterator_traits<_Iterator>::difference_type _ItDiffType;
 
-      template<typename _DiffType,
-	       typename = typename std::__is_void<_DiffType>::__type>
+      template<typename _DiffType, typename = _DiffType> // PR c++/85282
 	struct _DiffTraits
 	{ typedef _DiffType __type; };
 
       template<typename _DiffType>
-	struct _DiffTraits<_DiffType, std::__true_type>
+	struct _DiffTraits<_DiffType, void>
 	{ typedef std::ptrdiff_t __type; };
 
       typedef typename _DiffTraits<_ItDiffType>::__type _DiffType;