aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/atomic_wait.h3
-rw-r--r--libstdc++-v3/include/bits/binders.h5
-rw-r--r--libstdc++-v3/include/bits/c++config7
-rw-r--r--libstdc++-v3/include/bits/refwrap.h34
-rw-r--r--libstdc++-v3/include/bits/version.def16
-rw-r--r--libstdc++-v3/include/bits/version.h20
6 files changed, 83 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index 6d8c0de..84b8b4c 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -118,7 +118,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__atomic_eq(const _Tp& __a, const _Tp& __b)
{
// TODO make this do the correct padding bit ignoring comparison
- return __builtin_memcmp(&__a, &__b, sizeof(_Tp)) == 0;
+ return __builtin_memcmp(std::addressof(__a), std::addressof(__b),
+ sizeof(_Tp)) == 0;
}
// Storage for up to 64 bits of value, should be considered opaque bits.
diff --git a/libstdc++-v3/include/bits/binders.h b/libstdc++-v3/include/bits/binders.h
index 6489edd..9724717 100644
--- a/libstdc++-v3/include/bits/binders.h
+++ b/libstdc++-v3/include/bits/binders.h
@@ -125,7 +125,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_bound_args(__make_bound_args<_BoundArgs...>(std::forward<_Args>(__args)...))
{ static_assert(sizeof...(_Args) == sizeof...(_BoundArgs)); }
-#if __cpp_explicit_this_parameter
+#if _GLIBCXX_EXPLICIT_THIS_PARAMETER
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions" // deducing this
template<typename _Self, typename... _CallArgs>
constexpr _Result_t<_Self, _CallArgs...>
operator()(this _Self&& __self, _CallArgs&&... __call_args)
@@ -134,6 +136,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _S_call(__like_t<_Self, _Binder>(__self),
std::forward<_CallArgs>(__call_args)...);
}
+# pragma GCC diagnostic pop
#else
template<typename... _CallArgs>
requires true
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index eec3a4a..e6d8f18 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -927,6 +927,13 @@ namespace __gnu_cxx
# define _GLIBCXX_USE_BUILTIN_TRAIT(BT) 0
#endif
+// Whether deducing this is usable either officially, if in C++23 mode, or
+// as an extension (Clang doesn't support the latter).
+#if __cpp_explicit_this_parameter \
+ || (__cplusplus >= 201103L && __GNUC__ >= 14 && !defined(_GLIBCXX_CLANG))
+# define _GLIBCXX_EXPLICIT_THIS_PARAMETER 202110L
+#endif
+
// Mark code that should be ignored by the compiler, but seen by Doxygen.
#define _GLIBCXX_DOXYGEN_ONLY(X)
diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h
index 612715e..5d9f8c8 100644
--- a/libstdc++-v3/include/bits/refwrap.h
+++ b/libstdc++-v3/include/bits/refwrap.h
@@ -457,6 +457,40 @@ _GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type)
/// @}
+#if __glibcxx_common_reference_wrapper // C++ >= 20
+ namespace __detail
+ {
+ template<typename _Tp>
+ constexpr bool __is_ref_wrapper = false;
+
+ template<typename _Tp>
+ constexpr bool __is_ref_wrapper<reference_wrapper<_Tp>> = true;
+
+ template<typename _Rp, typename _Tp, typename _RQual, typename _TQual>
+ concept __ref_wrap_common_reference_exists_with = __is_ref_wrapper<_Rp>
+ && requires { typename common_reference_t<typename _Rp::type&, _TQual>; }
+ && convertible_to<_RQual, common_reference_t<typename _Rp::type&, _TQual>>;
+ } // namespace __detail
+
+ template<typename _Rp, typename _Tp,
+ template<typename> class _RQual, template<typename> class _TQual>
+ requires __detail::__ref_wrap_common_reference_exists_with<_Rp, _Tp,
+ _RQual<_Rp>, _TQual<_Tp>>
+ && (!__detail::__ref_wrap_common_reference_exists_with<_Tp, _Rp,
+ _TQual<_Tp>, _RQual<_Rp>>)
+ struct basic_common_reference<_Rp, _Tp, _RQual, _TQual>
+ { using type = common_reference_t<typename _Rp::type&, _TQual<_Tp>>; };
+
+ template<typename _Tp, typename _Rp,
+ template<typename> class _TQual, template<typename> class _RQual>
+ requires __detail::__ref_wrap_common_reference_exists_with<_Rp, _Tp,
+ _RQual<_Rp>, _TQual<_Tp>>
+ && (!__detail::__ref_wrap_common_reference_exists_with<_Tp, _Rp,
+ _TQual<_Tp>, _RQual<_Rp>>)
+ struct basic_common_reference<_Tp, _Rp, _TQual, _RQual>
+ { using type = common_reference_t<typename _Rp::type&, _TQual<_Tp>>; };
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index d20e085..412b9ce 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1822,6 +1822,22 @@ ftms = {
};
ftms = {
+ name = common_reference;
+ values = {
+ v = 202302;
+ cxxmin = 20; // We treat P2655R3 as a DR against C++20.
+ };
+};
+
+ftms = {
+ name = common_reference_wrapper;
+ values = {
+ v = 202302;
+ cxxmin = 20; // We treat P2655R3 as a DR against C++20.
+ };
+};
+
+ftms = {
name = formatters;
values = {
v = 202302;
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index c75368d4..2b96934 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -2030,6 +2030,26 @@
#endif /* !defined(__cpp_lib_flat_set) */
#undef __glibcxx_want_flat_set
+#if !defined(__cpp_lib_common_reference)
+# if (__cplusplus >= 202002L)
+# define __glibcxx_common_reference 202302L
+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_common_reference)
+# define __cpp_lib_common_reference 202302L
+# endif
+# endif
+#endif /* !defined(__cpp_lib_common_reference) && defined(__glibcxx_want_common_reference) */
+#undef __glibcxx_want_common_reference
+
+#if !defined(__cpp_lib_common_reference_wrapper)
+# if (__cplusplus >= 202002L)
+# define __glibcxx_common_reference_wrapper 202302L
+# if defined(__glibcxx_want_all) || defined(__glibcxx_want_common_reference_wrapper)
+# define __cpp_lib_common_reference_wrapper 202302L
+# endif
+# endif
+#endif /* !defined(__cpp_lib_common_reference_wrapper) && defined(__glibcxx_want_common_reference_wrapper) */
+#undef __glibcxx_want_common_reference_wrapper
+
#if !defined(__cpp_lib_formatters)
# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED
# define __glibcxx_formatters 202302L