public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-7227] libstdc++: Use __cpp_concepts instead of custom macro [PR103891]
Date: Mon, 14 Feb 2022 13:06:14 +0000 (GMT)	[thread overview]
Message-ID: <20220214130614.8D14D3858412@sourceware.org> (raw)

https://gcc.gnu.org/g:164a761a9f4798dc69ecab80097807636dc17d61

commit r12-7227-g164a761a9f4798dc69ecab80097807636dc17d61
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Feb 14 12:46:10 2022 +0000

    libstdc++: Use __cpp_concepts instead of custom macro [PR103891]
    
    With the new value of __cpp_concepts required by P2493, we can test
    whether the compiler supports conditionally trivial special members.
    This allows us to remove the workaround that disables fully-constexpr
    std::variant for Clang. Now it should work for non-GCC compilers (such
    as future releases of Clang) that support conditionally trivial
    destructors and define the new value of __cpp_concepts.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/103891
            * include/bits/c++config (_GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS):
            Remove.
            * include/std/variant: Check feature test macros instead.
            * include/std/version: Likewise.

Diff:
---
 libstdc++-v3/include/bits/c++config |  5 -----
 libstdc++-v3/include/std/variant    | 14 ++++++--------
 libstdc++-v3/include/std/version    |  4 ++--
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index b197349f976..c64b61b3c90 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -810,11 +810,6 @@ namespace std
 
 #undef _GLIBCXX_HAS_BUILTIN
 
-#if __cplusplus >= 202002L && __cpp_concepts && __GNUC__ >= 12
-// XXX workaround for missing feature test macro for P0848R3 (see P2493R0).
-# define _GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS 1
-#endif
-
 // PSTL configuration
 
 #if __cplusplus >= 201703L
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index c41f9f27e00..beed396fccb 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -44,24 +44,22 @@
 #include <bits/stl_iterator_base_funcs.h>
 #include <bits/stl_construct.h>
 #include <bits/utility.h> // in_place_index_t
-#ifndef _GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS
-# include <ext/aligned_buffer.h>
-#endif
 #if __cplusplus >= 202002L
 # include <compare>
 #endif
 
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-#ifdef _GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS
+#if __cpp_concepts >= 202002L && __cpp_constexpr >= 201811L
 // P2231R1 constexpr needs constexpr unions and constrained destructors.
 # define __cpp_lib_variant 202106L
 #else
+# include <ext/aligned_buffer.h> // Use __aligned_membuf instead of union.
 # define __cpp_lib_variant 202102L
 #endif
 
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   template<typename... _Types> class tuple;
   template<typename... _Types> class variant;
   template <typename> struct hash;
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 30e04b55555..24311ee05c8 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -175,7 +175,7 @@
 # define __cpp_lib_to_chars 201611L
 #endif
 #define __cpp_lib_unordered_map_try_emplace 201411L
-#ifndef _GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS
+#if !(__cplusplus >= 202002L && __cpp_concepts >= 202002L)
 // N.B. updated value in C++20
 # define __cpp_lib_variant 202102L
 #endif
@@ -292,7 +292,7 @@
 # endif
 #define __cpp_lib_to_address 201711L
 #define __cpp_lib_to_array 201907L
-#ifdef _GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS
+#if __cplusplus >= 202002L && __cpp_concepts >= 202002L
 # define __cpp_lib_variant 202106L
 #endif
 #endif


                 reply	other threads:[~2022-02-14 13:06 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=20220214130614.8D14D3858412@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).