[gcc r11-3569] libstdc++: Use __is_same instead of __is_same_as
Jonathan Wakely
redi@gcc.gnu.org
Wed Sep 30 17:42:16 GMT 2020
https://gcc.gnu.org/g:73ae6eb572515ad627b575a7fbdfdd47a4368e1c
commit r11-3569-g73ae6eb572515ad627b575a7fbdfdd47a4368e1c
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Sep 30 18:24:48 2020 +0100
libstdc++: Use __is_same instead of __is_same_as
PR 92271 added __is_same as another spelling of __is_same_as. Since
Clang also spells it __is_same, let's just use that consistently.
It appears that Intel icc sets __GNUC__ to 10, but only supports
__is_same_as. If we only use __is_same for __GNUC__ >= 11 then we won't
break icc again (it looks like we broke previous versions of icc when we
started using __is_same_as).
libstdc++-v3/ChangeLog:
* include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_IS_SAME):
Define for GCC 11 or when !__is_identifier(__is_same).
(_GLIBCXX_BUILTIN_IS_SAME_AS): Remove.
* include/std/type_traits (is_same, is_same_v): Replace uses
of _GLIBCXX_BUILTIN_IS_SAME_AS.
Diff:
---
libstdc++-v3/include/bits/c++config | 6 ++++--
libstdc++-v3/include/std/type_traits | 10 +++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 860bf6dbcb3..2e6c880ad95 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -658,10 +658,12 @@ namespace std
# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
-# define _GLIBCXX_BUILTIN_IS_SAME_AS(T, U) __is_same_as(T, U)
# if __GNUC__ >= 9
# define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1
# endif
+# if __GNUC__ >= 11
+# define _GLIBCXX_HAVE_BUILTIN_IS_SAME 1
+# endif
#elif defined(__is_identifier) && defined(__has_builtin)
// For non-GNU compilers:
# if ! __is_identifier(__has_unique_object_representations)
@@ -677,7 +679,7 @@ namespace std
# define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1
# endif
# if ! __is_identifier(__is_same)
-# define _GLIBCXX_BUILTIN_IS_SAME_AS(T, U) __is_same(T, U)
+# define _GLIBCXX_HAVE_BUILTIN_IS_SAME 1
# endif
#endif // GCC
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index b7bb63bbc74..9994c9ae3d7 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1394,14 +1394,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// is_same
template<typename _Tp, typename _Up>
struct is_same
-#ifdef _GLIBCXX_BUILTIN_IS_SAME_AS
- : public integral_constant<bool, _GLIBCXX_BUILTIN_IS_SAME_AS(_Tp, _Up)>
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME
+ : public integral_constant<bool, __is_same(_Tp, _Up)>
#else
: public false_type
#endif
{ };
-#ifndef _GLIBCXX_BUILTIN_IS_SAME_AS
+#ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME
template<typename _Tp>
struct is_same<_Tp, _Tp>
: public true_type
@@ -3215,9 +3215,9 @@ template <typename _Tp>
inline constexpr size_t rank_v = rank<_Tp>::value;
template <typename _Tp, unsigned _Idx = 0>
inline constexpr size_t extent_v = extent<_Tp, _Idx>::value;
-#ifdef _GLIBCXX_BUILTIN_IS_SAME_AS
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME
template <typename _Tp, typename _Up>
- inline constexpr bool is_same_v = _GLIBCXX_BUILTIN_IS_SAME_AS(_Tp, _Up);
+ inline constexpr bool is_same_v = __is_same(_Tp, _Up);
#else
template <typename _Tp, typename _Up>
inline constexpr bool is_same_v = std::is_same<_Tp, _Up>::value;
More information about the Libstdc++-cvs
mailing list