diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 43d8765228cee712e7ab407f2801d4890e115568..006b19c00fcd98d3577929a0072fc15efe064abb 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 6c130f772f8cce7e30b4a55096ea2c1d097e0714..2ec130446813a8eaa78c4c621377b9075989ae3a 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()
 {