From: Jonathan Wakely Date: Fri, 11 Oct 2019 15:53:44 +0000 (+0100) Subject: Use __is_same_as for std::is_same and std::is_same_v X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02f6fdff65671ccfaf2f79092ccdfccdef1bcebf;p=gcc.git Use __is_same_as for std::is_same and std::is_same_v By using the built-in we don't need to match a partial specialization for std::is_same and don't need to instantiate std::is_same at all for uses of std::is_same_v. * include/std/type_traits (is_same): Replace partial specialization by using __is_same_as built-in in primary template. (is_same_v): Use __is_same_as built-in instead of instantiating the is_same trait. From-SVN: r276891 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3e6a7ddb539..4b1b010ae97 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2019-10-11 Jonathan Wakely + * include/std/type_traits (is_same): Replace partial specialization + by using __is_same_as built-in in primary template. + (is_same_v): Use __is_same_as built-in instead of instantiating the + is_same trait. + PR libstdc++/92059 * include/tr2/dynamic_bitset (__dynamic_bitset_base): Define all special member functions as defaulted. Add noexcept to most members. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index dc8a019324d..4de5daa9f06 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1388,13 +1388,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Type relations. /// is_same - template + template struct is_same - : public false_type { }; - - template - struct is_same<_Tp, _Tp> - : public true_type { }; + : public integral_constant + { }; /// is_base_of template @@ -3158,7 +3155,7 @@ template template inline constexpr size_t extent_v = extent<_Tp, _Idx>::value; template - inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; + inline constexpr bool is_same_v = __is_same_as(_Tp, _Up); template inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value; template