From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 983333857C45; Wed, 22 Mar 2023 17:49:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 983333857C45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679507387; bh=t5ET/3ZApFgTJgYvTA6lC9uBZh6xzvOBHmsyoQktK8k=; h=From:To:Subject:Date:From; b=QEwmlJVdR5o9IeTdf9UeZN/or2D+fgUwTzMZzD0LhcdepyZ3yE+0M5nfyXtlJiFgQ TyjzjUJ+tGROD1o2M1Q7a6ZjCBm1JvPmFYmWBHT5N80gNupSR2m1HWz0oyvAWZ2c35 0M+0LKl+l/kLBQSDZU39vrKNxB2hg+HHqheCc37w= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-6810] libstdc++: Define __cpp_lib_constexpr_algorithms in (LWG 3792) X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 02e86035d30e9f7b8645ebb64f4028900fc37126 X-Git-Newrev: 924d990425d29ef39f3faac49d4a3772e4302c96 Message-Id: <20230322174947.983333857C45@sourceware.org> Date: Wed, 22 Mar 2023 17:49:47 +0000 (GMT) List-Id: https://gcc.gnu.org/g:924d990425d29ef39f3faac49d4a3772e4302c96 commit r13-6810-g924d990425d29ef39f3faac49d4a3772e4302c96 Author: Jonathan Wakely Date: Wed Mar 22 12:55:29 2023 +0000 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: --- 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 _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 +#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() {