Clang doesn't support __is_same_as but provides __is_same instead.
Restore the original implementation (pre r276891) when neither of those
built-ins is available.
* include/bits/c++config (_GLIBCXX_BUILTIN_IS_SAME_AS): Define to
one of __is_same_as or __is_same when available.
* include/std/concepts (__detail::__same_as): Use std::is_same_v.
* include/std/type_traits (is_same) [_GLIBCXX_BUILTIN_IS_SAME_AS]:
Use new macro instead of __is_same_as.
(is_same) [!_GLIBCXX_BUILTIN_IS_SAME_AS]: Restore partial
specialization.
(is_same_v) [_GLIBCXX_BUILTIN_IS_SAME_AS]: Use new macro.
(is_same_v) [!_GLIBCXX_BUILTIN_IS_SAME_AS]: Use std::is_same.
From-SVN: r277058
+2019-10-16 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/c++config (_GLIBCXX_BUILTIN_IS_SAME_AS): Define to
+ one of __is_same_as or __is_same when available.
+ * include/std/concepts (__detail::__same_as): Use std::is_same_v.
+ * include/std/type_traits (is_same) [_GLIBCXX_BUILTIN_IS_SAME_AS]:
+ Use new macro instead of __is_same_as.
+ (is_same) [!_GLIBCXX_BUILTIN_IS_SAME_AS]: Restore partial
+ specialization.
+ (is_same_v) [_GLIBCXX_BUILTIN_IS_SAME_AS]: Use new macro.
+ (is_same_v) [!_GLIBCXX_BUILTIN_IS_SAME_AS]: Use std::is_same.
+
2019-10-16 François Dumont <fdumont@gcc.gnu.org>
* src/c++11/debug.cc (print_field): Replace constness_names <unknown>
# 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 __has_builtin(__builtin_is_constant_evaluated)
# 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)
+# endif
#endif // GCC
// PSTL configuration
// <http://www.gnu.org/licenses/>.
/** @file include/concepts
- * This is __a Standard C++ Library header.
+ * This is a Standard C++ Library header.
* @ingroup concepts
*/
namespace __detail
{
template<typename _Tp, typename _Up>
- concept __same_as = __is_same_as(_Tp, _Up);
+ concept __same_as = std::is_same_v<_Tp, _Up>;
} // namespace __detail
/// [concept.same], concept same_as
/// is_same
template<typename _Tp, typename _Up>
struct is_same
- : public integral_constant<bool, __is_same_as(_Tp, _Up)>
+#ifdef _GLIBCXX_BUILTIN_IS_SAME_AS
+ : public integral_constant<bool, _GLIBCXX_BUILTIN_IS_SAME_AS(_Tp, _Up)>
+#else
+ : public false_type
+#endif
{ };
+#ifndef _GLIBCXX_BUILTIN_IS_SAME_AS
+ template<typename _Tp>
+ struct is_same<_Tp, _Tp>
+ : public true_type
+ { };
+#endif
+
/// is_base_of
template<typename _Base, typename _Derived>
struct is_base_of
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
template <typename _Tp, typename _Up>
- inline constexpr bool is_same_v = __is_same_as(_Tp, _Up);
+ inline constexpr bool is_same_v = _GLIBCXX_BUILTIN_IS_SAME_AS(_Tp, _Up);
+#else
+template <typename _Tp, typename _Up>
+ inline constexpr bool is_same_v = std::is_same<_Tp, _Up>::value;
+#endif
template <typename _Base, typename _Derived>
inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
template <typename _From, typename _To>