From bb323ec8fdfce6dc22b1ca13a2c381f1496c545d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 10 Apr 2025 11:00:36 +0100 Subject: [PATCH] libstdc++: Adjust value of __cpp_lib_constrained_equality for C++20 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. --- 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 " -#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