aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-11-25 15:06:13 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2024-11-30 21:39:16 +0000
commit0598e2f98d28f3ddbf1a4bbced8177ea6b58ad93 (patch)
treee78ec9995f435047111ea8e6eab8f2c9dd861f39
parent2ae0566243c8dacec17ff233e41688f05366d886 (diff)
downloadgcc-0598e2f98d28f3ddbf1a4bbced8177ea6b58ad93.zip
gcc-0598e2f98d28f3ddbf1a4bbced8177ea6b58ad93.tar.gz
gcc-0598e2f98d28f3ddbf1a4bbced8177ea6b58ad93.tar.bz2
libstdc++: Improve test for <utility> synopsis
libstdc++-v3/ChangeLog: * testsuite/20_util/headers/utility/synopsis.cc: Add declarations from C++11 and later.
-rw-r--r--libstdc++-v3/testsuite/20_util/headers/utility/synopsis.cc108
1 files changed, 102 insertions, 6 deletions
diff --git a/libstdc++-v3/testsuite/20_util/headers/utility/synopsis.cc b/libstdc++-v3/testsuite/20_util/headers/utility/synopsis.cc
index dddb54f..51e88b7 100644
--- a/libstdc++-v3/testsuite/20_util/headers/utility/synopsis.cc
+++ b/libstdc++-v3/testsuite/20_util/headers/utility/synopsis.cc
@@ -20,6 +20,36 @@
#include <utility>
+#if __cplusplus < 201103L
+# define CONSTEXPR
+#else
+# define CONSTEXPR constexpr
+#endif
+
+#if __cplusplus < 201402L && ! defined(_GLIBCXX_RELEASE)
+# define CONSTEXPR11x
+#else
+# define CONSTEXPR11x constexpr
+#endif
+
+#if __cplusplus < 201402L
+# define CONSTEXPR14
+#else
+# define CONSTEXPR14 constexpr
+#endif
+
+#if __cplusplus < 201703L
+# define CONSTEXPR17
+#else
+# define CONSTEXPR17 constexpr
+#endif
+
+#if __cplusplus < 202002L
+# define CONSTEXPR20
+#else
+# define CONSTEXPR20 constexpr
+#endif
+
namespace std {
// lib.operators, operators:
namespace rel_ops {
@@ -29,18 +59,84 @@ namespace std {
template<class T> bool operator>=(const T&, const T&);
}
+#if __cplusplus >= 201103L
+#if 0
+ // N.B. our std::swap doesn't actually match this due to constraints on
+ // the template parameter.
+ template<class T>
+ CONSTEXPR20
+ void swap(T&, T&) noexcept(is_nothrow_move_constructible<T>::value
+ && is_nothrow_move_assignable<T>::value);
+#endif
+
+ template<class T, size_t N>
+ CONSTEXPR20
+ void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
+
+#if __cplusplus >= 201703L
+ template <class T, class U /* = T */>
+ CONSTEXPR20
+ T exchange(T& obj, U&& new_val)
+#if defined _GLIBCXX_RELEASE // This noexcept is a libstdc++ extension.
+ noexcept(__and_<is_nothrow_move_constructible<T>,
+ is_nothrow_assignable<T&, U>>::value)
+#endif
+ ;
+#endif
+
+ template<class T>
+ CONSTEXPR11x
+ T&& forward(typename remove_reference<T>::type& t) noexcept;
+ template<class T>
+ CONSTEXPR11x
+ T&& forward(typename remove_reference<T>::type&& t) noexcept;
+
+ template<class T>
+ CONSTEXPR11x
+ typename remove_reference<T>::type&& move(T&& t) noexcept;
+
+ template<class T>
+ CONSTEXPR17
+ typename conditional< ! is_nothrow_move_constructible<T>::value
+ && is_copy_constructible<T>::value,
+ const T&, T&&>::type
+ move_if_noexcept(T& x) noexcept;
+
+#if __cplusplus >= 201703L
+ template<class T>
+ constexpr add_const_t<T>& as_const(T& t) noexcept;
+#endif
+
+ template <class T>
+ typename add_rvalue_reference<T>::type declval() noexcept;
+
+#if __cplusplus >= 201402L
+ template<class T, T...> struct integer_sequence;
+#endif
+
+#endif // C++11
+
// lib.pairs, pairs:
template <class T1, class T2> struct pair;
template <class T1, class T2>
- _GLIBCXX_CONSTEXPR bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
+ CONSTEXPR bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2>
- _GLIBCXX_CONSTEXPR bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
+ CONSTEXPR bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2>
- _GLIBCXX_CONSTEXPR bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
+ CONSTEXPR bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2>
- _GLIBCXX_CONSTEXPR bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
+ CONSTEXPR bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2>
- _GLIBCXX_CONSTEXPR bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
+ CONSTEXPR bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2>
- _GLIBCXX_CONSTEXPR bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
+ CONSTEXPR bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
+
+#if __cplusplus >= 201103L
+ struct piecewise_construct_t;
+#if __cplusplus >= 201703L
+ struct in_place_t;
+ template<class> struct in_place_type_t;
+ template<size_t> struct in_place_index_t;
+#endif
+#endif
}