aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/variant
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-02-14 12:46:10 +0000
committerJonathan Wakely <jwakely@redhat.com>2022-02-14 13:03:31 +0000
commit164a761a9f4798dc69ecab80097807636dc17d61 (patch)
tree56fcdebdec88734259b5fe23a5ba564993aac953 /libstdc++-v3/include/std/variant
parent220d85fdf0b5d61e212289fd6ec763980700c572 (diff)
downloadgcc-164a761a9f4798dc69ecab80097807636dc17d61.zip
gcc-164a761a9f4798dc69ecab80097807636dc17d61.tar.gz
gcc-164a761a9f4798dc69ecab80097807636dc17d61.tar.bz2
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.
Diffstat (limited to 'libstdc++-v3/include/std/variant')
-rw-r--r--libstdc++-v3/include/std/variant14
1 files changed, 6 insertions, 8 deletions
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index c41f9f2..beed396 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;