libstdc++-v3/ChangeLog:

        * testsuite/20_util/headers/utility/synopsis.cc: Add
        declarations from C++11 and later.
---

It's a bit messy with all the macros, but I think it's still better to
have one test that runs as every -std mode than having 4+ tests that are
only valid in one or two -std modes. Maybe others disagree?

Tested x86_64-linux.

 .../20_util/headers/utility/synopsis.cc       | 108 +++++++++++++++++-
 1 file 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 dddb54fd48a..51e88b70f51 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
 }
-- 
2.47.0

Reply via email to