public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6810] libstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792)
@ 2023-03-22 17:49 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-03-22 17:49 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:924d990425d29ef39f3faac49d4a3772e4302c96

commit r13-6810-g924d990425d29ef39f3faac49d4a3772e4302c96
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Mar 22 12:55:29 2023 +0000

    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.

Diff:
---
 libstdc++-v3/include/std/utility                     | 4 ++++
 libstdc++-v3/testsuite/20_util/exchange/constexpr.cc | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 43d8765228c..006b19c00fc 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 6c130f772f8..2ec13044681 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()
 {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-22 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 17:49 [gcc r13-6810] libstdc++: Define __cpp_lib_constexpr_algorithms in <utility> (LWG 3792) Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).