]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792)
authorJonathan Wakely <jwakely@redhat.com>
Wed, 22 Mar 2023 12:55:29 +0000 (12:55 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 11 Jun 2024 12:35:09 +0000 (13:35 +0100)
We actually defined this macro in <utility> at one point, but I removed
it in r10-7901-g2025db692e9ed1.

libstdc++-v3/ChangeLog:

* include/std/utility (__cpp_lib_constexpr_algorithms): Define,
as per LWG 3792.
* testsuite/20_util/exchange/constexpr.cc: Check for it.

(cherry picked from commit 924d990425d29ef39f3faac49d4a3772e4302c96)

libstdc++-v3/include/std/utility
libstdc++-v3/testsuite/20_util/exchange/constexpr.cc

index fb618356c414550d77c6c4608cc75428a20a5dfd..acc47d649768dfbb9b408d2896eebc5a6cf00e1a 100644 (file)
@@ -86,6 +86,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cplusplus >= 201402L
 #define __cpp_lib_exchange_function 201304L
 
+#if __cplusplus > 201703L
+# define __cpp_lib_constexpr_algorithms 201806L
+#endif
+
   /// Assign @p __new_val to @p __obj and return its previous value.
   template <typename _Tp, typename _Up = _Tp>
     _GLIBCXX20_CONSTEXPR
index 7a7ecd35db73d1b60a17c2475ff97cca2e864d58..e7dc31ed986643e7822f341230e3ca00fa276d87 100644 (file)
 
 #include <utility>
 
+#ifndef __cpp_lib_constexpr_algorithms
+# error "Feature test macro for constexpr std::exchange is missing in <utility>"
+#elif __cpp_lib_constexpr_algorithms < 201806L
+# error "Feature test macro for constexpr std::exchange has wrong value in <utility>"
+#endif
+
 constexpr bool
 test()
 {