From: Jonathan Wakely Date: Wed, 22 Mar 2023 12:55:29 +0000 (+0000) Subject: libstdc++: Define __cpp_lib_constexpr_algorithms in (LWG 3792) X-Git-Tag: basepoints/gcc-14~397 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=924d990425d29ef39f3faac49d4a3772e4302c96;p=thirdparty%2Fgcc.git libstdc++: Define __cpp_lib_constexpr_algorithms in (LWG 3792) We actually defined this macro in 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 --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 43d8765228ce..006b19c00fcd 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 _GLIBCXX20_CONSTEXPR diff --git a/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc b/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc index 6c130f772f8c..2ec130446813 100644 --- a/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/exchange/constexpr.cc @@ -20,6 +20,12 @@ #include +#ifndef __cpp_lib_constexpr_algorithms +# error "Feature test macro for constexpr std::exchange is missing in " +#elif __cpp_lib_constexpr_algorithms < 201806L +# error "Feature test macro for constexpr std::exchange has wrong value in " +#endif + constexpr bool test() {