The P3379R0 bump to __cpp_lib_constrained_equality relates to changes
that only affect std::expected, so there's no reason to define the
updated value in C++20.

This change restores the previous value (202403) for C++20, and only
uses the new value (202411) for C++23 and later.

Also remove the TODO comments, because I correctly predicted that the
final value would be 202411.

libstdc++-v3/ChangeLog:

        * include/bits/version.def (constrained_equality): Only define
        as 202411 for C++23 and later, use 202403 for C++20.
        * include/bits/version.h: Regenerate.
        * testsuite/20_util/expected/equality_constrained.cc: Remove
        TODO comment.
---

Tested x86_64-linux. Pushed to trunk.

N.B. strictly speaking neither of the papers that modified the
__cpp_lib_constrained_equality macro (P2944R3 and P3379R0) were approved
as a DR, so it's a C++26 feature. But we support the constraints back to
C++20 (or back to C++23 for std::expected). Defaulted comparisons work
better if these comparisons are properly constrained.

 libstdc++-v3/include/bits/version.def                      | 7 ++++++-
 libstdc++-v3/include/bits/version.h                        | 7 ++++++-
 .../testsuite/20_util/expected/equality_constrained.cc     | 2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index 8f609b469cc..2ec1b40bd38 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1273,7 +1273,12 @@ ftms = {
 ftms = {
   name = constrained_equality;
   values = {
-    v = 202411; // FIXME: 202403 for P2944R3, ??? for P3379R0
+    v = 202411;
+    cxxmin = 23;
+    extra_cond = "__glibcxx_three_way_comparison";
+  };
+  values = {
+    v = 202403;
     cxxmin = 20;
     extra_cond = "__glibcxx_three_way_comparison";
   };
diff --git a/libstdc++-v3/include/bits/version.h 
b/libstdc++-v3/include/bits/version.h
index f05c3fd13c0..04c1349c84b 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -1406,11 +1406,16 @@
 #undef __glibcxx_want_constexpr_vector
 
 #if !defined(__cpp_lib_constrained_equality)
-# if (__cplusplus >= 202002L) && (__glibcxx_three_way_comparison)
+# if (__cplusplus >= 202100L) && (__glibcxx_three_way_comparison)
 #  define __glibcxx_constrained_equality 202411L
 #  if defined(__glibcxx_want_all) || 
defined(__glibcxx_want_constrained_equality)
 #   define __cpp_lib_constrained_equality 202411L
 #  endif
+# elif (__cplusplus >= 202002L) && (__glibcxx_three_way_comparison)
+#  define __glibcxx_constrained_equality 202403L
+#  if defined(__glibcxx_want_all) || 
defined(__glibcxx_want_constrained_equality)
+#   define __cpp_lib_constrained_equality 202403L
+#  endif
 # endif
 #endif /* !defined(__cpp_lib_constrained_equality) && 
defined(__glibcxx_want_constrained_equality) */
 #undef __glibcxx_want_constrained_equality
diff --git a/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc 
b/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc
index 7f6cefae748..a079d98129f 100644
--- a/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/equality_constrained.cc
@@ -4,7 +4,7 @@
 
 #ifndef __cpp_lib_constrained_equality
 # error "Feature-test macro for constrained_equality missing in <expected>"
-#elif __cpp_lib_constrained_equality < 202411L // TODO: use final value
+#elif __cpp_lib_constrained_equality < 202411L
 # error "Feature-test macro for constrained_equality has wrong value"
 #endif
 
-- 
2.49.0

Reply via email to