diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-09-30 18:24:48 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-09-30 18:41:12 +0100 |
commit | 73ae6eb572515ad627b575a7fbdfdd47a4368e1c (patch) | |
tree | aaed6e14092cf913cfc5defb44616e24a5b0a8ad | |
parent | 091ddcc1b2199cdf8146fb00cf55ef9162e237b9 (diff) | |
download | gcc-73ae6eb572515ad627b575a7fbdfdd47a4368e1c.zip gcc-73ae6eb572515ad627b575a7fbdfdd47a4368e1c.tar.gz gcc-73ae6eb572515ad627b575a7fbdfdd47a4368e1c.tar.bz2 |
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.
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 6 | ||||
-rw-r--r-- | 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 860bf6d..2e6c880 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 b7bb63b..9994c9a 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; |