aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-03-22 12:55:29 +0000
committerJonathan Wakely <jwakely@redhat.com>2024-06-11 13:35:09 +0100
commit3837f956515eb8aff4f933eac83f4c6d1a0f1f48 (patch)
tree1d876d9a23e7bbd1015bb4f78e6dec410ff70987
parent4d257dac0adecc7ce6b1b871cd5e99ae75f0688f (diff)
downloadgcc-3837f956515eb8aff4f933eac83f4c6d1a0f1f48.zip
gcc-3837f956515eb8aff4f933eac83f4c6d1a0f1f48.tar.gz
gcc-3837f956515eb8aff4f933eac83f4c6d1a0f1f48.tar.bz2
libstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792)
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)
-rw-r--r--libstdc++-v3/include/std/utility4
-rw-r--r--libstdc++-v3/testsuite/20_util/exchange/constexpr.cc6
2 files changed, 10 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index fb61835..acc47d6 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -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
diff --git a/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc b/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc
index 7a7ecd3..e7dc31e 100644
--- a/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc
+++ b/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc
@@ -20,6 +20,12 @@
#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()
{