public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Fix incorrect preprocessor conditions in <version>
Date: Tue, 29 Mar 2022 10:11:33 +0100	[thread overview]
Message-ID: <20220329091133.1611004-1-jwakely@redhat.com> (raw)

Tested powerpc64le-linux, pushed to trunk.

-- >8 --

The conditions that guard the feature test macros in <version> should
match the main definitions of the macros in other headers.

This doesn't matter for GCC, because it supports all the conditions
being tested here, but it does matter for non-GCC compilers without the
relevant C++20 features.

libstdc++-v3/ChangeLog:

	* include/std/version (__cpp_lib_variant): Fix conditions to
	match <variant>.
	(__cpp_lib_expected): Fix condition to match <expected>.
---
 libstdc++-v3/include/std/version | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 7dbac23f22d..44b8a9f88b5 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -176,7 +176,7 @@
 # define __cpp_lib_to_chars 201611L
 #endif
 #define __cpp_lib_unordered_map_try_emplace 201411L
-#if !(__cplusplus >= 202002L && __cpp_concepts >= 202002L)
+#if !(__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L)
 // N.B. updated value in C++20
 # define __cpp_lib_variant 202102L
 #endif
@@ -293,7 +293,7 @@
 # endif
 #define __cpp_lib_to_address 201711L
 #define __cpp_lib_to_array 201907L
-#if __cplusplus >= 202002L && __cpp_concepts >= 202002L
+#if __cpp_concepts >= 202002L && __cpp_constexpr >= 201811L
 # define __cpp_lib_variant 202106L
 #endif
 #endif
@@ -306,7 +306,9 @@
 
 #if _GLIBCXX_HOSTED
 #define __cpp_lib_adaptor_iterator_pair_constructor 202106L
-#define __cpp_lib_expected 202202L
+#if __cpp_concepts >= 202002L
+# define __cpp_lib_expected 202202L
+#endif
 #define __cpp_lib_invoke_r 202106L
 #define __cpp_lib_ios_noreplace 202200L
 #if __cpp_lib_concepts
-- 
2.34.1


                 reply	other threads:[~2022-03-29  9:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220329091133.1611004-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).