[libcxx-commits] [libcxx] a13822b - [libc++] Simplify type_traits a bit more

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 27 01:19:21 PDT 2022


Author: Nikolas Klauser
Date: 2022-08-27T10:19:11+02:00
New Revision: a13822b35d11cb6afa759fa0672fbc0b6ef295d0

URL: https://github.com/llvm/llvm-project/commit/a13822b35d11cb6afa759fa0672fbc0b6ef295d0
DIFF: https://github.com/llvm/llvm-project/commit/a13822b35d11cb6afa759fa0672fbc0b6ef295d0.diff

LOG: [libc++] Simplify type_traits a bit more

Reviewed By: ldionne, #libc

Spies: STL_MSFT, CaseyCarter, huixie90, libcxx-commits

Differential Revision: https://reviews.llvm.org/D129094

Added: 
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h

Modified: 
    libcxx/include/__type_traits/alignment_of.h
    libcxx/include/__type_traits/apply_cv.h
    libcxx/include/__type_traits/decay.h
    libcxx/include/__type_traits/disjunction.h
    libcxx/include/__type_traits/has_virtual_destructor.h
    libcxx/include/__type_traits/is_assignable.h
    libcxx/include/__type_traits/is_class.h
    libcxx/include/__type_traits/is_constructible.h
    libcxx/include/__type_traits/is_copy_assignable.h
    libcxx/include/__type_traits/is_copy_constructible.h
    libcxx/include/__type_traits/is_default_constructible.h
    libcxx/include/__type_traits/is_enum.h
    libcxx/include/__type_traits/is_literal_type.h
    libcxx/include/__type_traits/is_move_assignable.h
    libcxx/include/__type_traits/is_move_constructible.h
    libcxx/include/__type_traits/is_nothrow_assignable.h
    libcxx/include/__type_traits/is_nothrow_constructible.h
    libcxx/include/__type_traits/is_nothrow_copy_assignable.h
    libcxx/include/__type_traits/is_nothrow_copy_constructible.h
    libcxx/include/__type_traits/is_nothrow_default_constructible.h
    libcxx/include/__type_traits/is_nothrow_destructible.h
    libcxx/include/__type_traits/is_nothrow_move_assignable.h
    libcxx/include/__type_traits/is_nothrow_move_constructible.h
    libcxx/include/__type_traits/is_pod.h
    libcxx/include/__type_traits/is_standard_layout.h
    libcxx/include/__type_traits/is_trivial.h
    libcxx/include/__type_traits/is_trivially_assignable.h
    libcxx/include/__type_traits/is_trivially_constructible.h
    libcxx/include/__type_traits/is_trivially_copy_assignable.h
    libcxx/include/__type_traits/is_trivially_copy_constructible.h
    libcxx/include/__type_traits/is_trivially_copyable.h
    libcxx/include/__type_traits/is_trivially_default_constructible.h
    libcxx/include/__type_traits/is_trivially_destructible.h
    libcxx/include/__type_traits/is_trivially_move_assignable.h
    libcxx/include/__type_traits/is_trivially_move_constructible.h
    libcxx/include/__type_traits/is_union.h
    libcxx/include/__type_traits/negation.h
    libcxx/include/__type_traits/rank.h
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h
index 65c603058ffae..45b4cbcc2d7db 100644
--- a/libcxx/include/__type_traits/alignment_of.h
+++ b/libcxx/include/__type_traits/alignment_of.h
@@ -24,7 +24,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
+inline constexpr size_t alignment_of_v = _LIBCPP_ALIGNOF(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/apply_cv.h b/libcxx/include/__type_traits/apply_cv.h
index 4a5aab48a7230..766fb799ccddb 100644
--- a/libcxx/include/__type_traits/apply_cv.h
+++ b/libcxx/include/__type_traits/apply_cv.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___TYPE_TRAITS_APPLY_CV_H
 
 #include <__config>
-#include <__type_traits/integral_constant.h>
 #include <__type_traits/is_const.h>
 #include <__type_traits/is_volatile.h>
 #include <__type_traits/remove_reference.h>

diff  --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h
index ba727db3d0c8f..f4c2e34260c7c 100644
--- a/libcxx/include/__type_traits/decay.h
+++ b/libcxx/include/__type_traits/decay.h
@@ -12,7 +12,6 @@
 #include <__config>
 #include <__type_traits/add_pointer.h>
 #include <__type_traits/conditional.h>
-#include <__type_traits/integral_constant.h>
 #include <__type_traits/is_array.h>
 #include <__type_traits/is_function.h>
 #include <__type_traits/is_referenceable.h>

diff  --git a/libcxx/include/__type_traits/disjunction.h b/libcxx/include/__type_traits/disjunction.h
index 6c6d1a8f21b6b..465411acb316e 100644
--- a/libcxx/include/__type_traits/disjunction.h
+++ b/libcxx/include/__type_traits/disjunction.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___TYPE_TRAITS_DISJUNCTION_H
 
 #include <__config>
-#include <__type_traits/conditional.h>
 #include <__type_traits/integral_constant.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/__type_traits/has_virtual_destructor.h b/libcxx/include/__type_traits/has_virtual_destructor.h
index 1f0bd188b7174..e73a2b280cb09 100644
--- a/libcxx/include/__type_traits/has_virtual_destructor.h
+++ b/libcxx/include/__type_traits/has_virtual_destructor.h
@@ -18,21 +18,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if __has_builtin(__has_virtual_destructor)
-
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
     : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
 
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
-    : public false_type {};
-
-#endif
-
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value;
+inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_assignable.h b/libcxx/include/__type_traits/is_assignable.h
index b8cb6df9df4a3..13cd682f53cba 100644
--- a/libcxx/include/__type_traits/is_assignable.h
+++ b/libcxx/include/__type_traits/is_assignable.h
@@ -18,10 +18,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; };
-
-#if __has_builtin(__is_assignable)
-
 template<class _Tp, class _Up>
 struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { };
 
@@ -30,37 +26,6 @@ template <class _Tp, class _Arg>
 inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg);
 #endif
 
-#else // __has_builtin(__is_assignable)
-
-template <class _Tp, class _Arg>
-typename __select_2nd<decltype((declval<_Tp>() = declval<_Arg>())), true_type>::type
-__is_assignable_test(int);
-
-template <class, class>
-false_type __is_assignable_test(...);
-
-
-template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
-struct __is_assignable_imp
-    : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {};
-
-template <class _Tp, class _Arg>
-struct __is_assignable_imp<_Tp, _Arg, true>
-    : public false_type
-{
-};
-
-template <class _Tp, class _Arg>
-struct is_assignable
-    : public __is_assignable_imp<_Tp, _Arg> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp, class _Arg>
-inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value;
-#endif
-
-#endif // __has_builtin(__is_assignable)
-
 _LIBCPP_END_NAMESPACE_STD
 
 #endif // _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H

diff  --git a/libcxx/include/__type_traits/is_class.h b/libcxx/include/__type_traits/is_class.h
index cddaeae6e8a9f..031430f6654dc 100644
--- a/libcxx/include/__type_traits/is_class.h
+++ b/libcxx/include/__type_traits/is_class.h
@@ -11,8 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_union.h>
-#include <__type_traits/remove_cv.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header

diff  --git a/libcxx/include/__type_traits/is_constructible.h b/libcxx/include/__type_traits/is_constructible.h
index 9a96c3df13e8a..cbe61b4329e3d 100644
--- a/libcxx/include/__type_traits/is_constructible.h
+++ b/libcxx/include/__type_traits/is_constructible.h
@@ -25,7 +25,7 @@ struct _LIBCPP_TEMPLATE_VIS is_constructible
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp, class ..._Args>
-inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value;
+inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_copy_assignable.h b/libcxx/include/__type_traits/is_copy_assignable.h
index e46b1249459ed..c489af6511c4a 100644
--- a/libcxx/include/__type_traits/is_copy_assignable.h
+++ b/libcxx/include/__type_traits/is_copy_assignable.h
@@ -13,7 +13,6 @@
 #include <__type_traits/add_const.h>
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_assignable.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,9 +20,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable
-    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
-                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_copy_assignable
+    : public integral_constant<
+          bool,
+          __is_assignable(typename add_lvalue_reference<_Tp>::type,
+                          typename add_lvalue_reference<typename add_const<_Tp>::type>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_copy_constructible.h b/libcxx/include/__type_traits/is_copy_constructible.h
index 18dc27f2ef75f..93e60c4fcabf4 100644
--- a/libcxx/include/__type_traits/is_copy_constructible.h
+++ b/libcxx/include/__type_traits/is_copy_constructible.h
@@ -13,7 +13,6 @@
 #include <__type_traits/add_const.h>
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -23,8 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_copy_constructible
-    : public is_constructible<_Tp,
-                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+    : public integral_constant<
+          bool,
+          __is_constructible(_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_default_constructible.h b/libcxx/include/__type_traits/is_default_constructible.h
index a6368413d6b45..d2180c6a85576 100644
--- a/libcxx/include/__type_traits/is_default_constructible.h
+++ b/libcxx/include/__type_traits/is_default_constructible.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,12 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_default_constructible
-    : public is_constructible<_Tp>
+    : public integral_constant<bool, __is_constructible(_Tp)>
     {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value;
+inline constexpr bool is_default_constructible_v = __is_constructible(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_enum.h b/libcxx/include/__type_traits/is_enum.h
index bf6921c88c940..4c1db415d5a64 100644
--- a/libcxx/include/__type_traits/is_enum.h
+++ b/libcxx/include/__type_traits/is_enum.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/remove_cv.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header

diff  --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h
index df525ecee208d..be01745505933 100644
--- a/libcxx/include/__type_traits/is_literal_type.h
+++ b/libcxx/include/__type_traits/is_literal_type.h
@@ -25,7 +25,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
+_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp);
 #endif // _LIBCPP_STD_VER > 14
 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
 

diff  --git a/libcxx/include/__type_traits/is_move_assignable.h b/libcxx/include/__type_traits/is_move_assignable.h
index 1e8aa23bea378..2953e0ab581fd 100644
--- a/libcxx/include/__type_traits/is_move_assignable.h
+++ b/libcxx/include/__type_traits/is_move_assignable.h
@@ -10,11 +10,9 @@
 #define _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H
 
 #include <__config>
-#include <__type_traits/add_const.h>
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/add_rvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_assignable.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -22,9 +20,11 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable
-    : public is_assignable<typename add_lvalue_reference<_Tp>::type,
-                           typename add_rvalue_reference<_Tp>::type> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_move_assignable
+    : public integral_constant<
+          bool,
+          __is_assignable(typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_move_constructible.h b/libcxx/include/__type_traits/is_move_constructible.h
index 228cee7efffaa..6a1148e5e1bad 100644
--- a/libcxx/include/__type_traits/is_move_constructible.h
+++ b/libcxx/include/__type_traits/is_move_constructible.h
@@ -12,7 +12,6 @@
 #include <__config>
 #include <__type_traits/add_rvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -22,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_move_constructible
-    : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
+    : public integral_constant<bool, __is_constructible(_Tp, typename add_rvalue_reference<_Tp>::type)>
     {};
 
 #if _LIBCPP_STD_VER > 14

diff  --git a/libcxx/include/__type_traits/is_nothrow_assignable.h b/libcxx/include/__type_traits/is_nothrow_assignable.h
index e3ce33ece8955..0cd9d5d734148 100644
--- a/libcxx/include/__type_traits/is_nothrow_assignable.h
+++ b/libcxx/include/__type_traits/is_nothrow_assignable.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_ASSIGNABLE_H
 
 #include <__config>
-#include <__type_traits/add_const.h>
 #include <__type_traits/integral_constant.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -19,39 +18,13 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if __has_builtin(__is_nothrow_assignable)
-
 template <class _Tp, class _Arg>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
     : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
 
-#else
-
-template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
-
-template <class _Tp, class _Arg>
-struct __libcpp_is_nothrow_assignable<false, _Tp, _Arg>
-    : public false_type
-{
-};
-
-template <class _Tp, class _Arg>
-struct __libcpp_is_nothrow_assignable<true, _Tp, _Arg>
-    : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Arg>()) >
-{
-};
-
-template <class _Tp, class _Arg>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
-    : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg>
-{
-};
-
-#endif // __has_builtin(__is_nothrow_assignable)
-
 #if _LIBCPP_STD_VER > 14
 template <class _Tp, class _Arg>
-inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value;
+inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_Tp, _Arg);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_nothrow_constructible.h b/libcxx/include/__type_traits/is_nothrow_constructible.h
index 92d6e8343e03b..6dc6ccd450d88 100644
--- a/libcxx/include/__type_traits/is_nothrow_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_constructible.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__utility/declval.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,10 +20,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if __has_builtin(__is_nothrow_constructible)
 
-template <class _Tp, class... _Args>
+template <
+    class _Tp, class... _Args>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
     : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
-
 #else
 
 template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;

diff  --git a/libcxx/include/__type_traits/is_nothrow_copy_assignable.h b/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
index 8c4b8fd1628b8..f9a947488180a 100644
--- a/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
+++ b/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
@@ -13,7 +13,6 @@
 #include <__type_traits/add_const.h>
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_nothrow_assignable.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,9 +20,13 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable
-    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
-                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable
+    : public integral_constant<
+          bool,
+          __is_nothrow_assignable(
+              typename add_lvalue_reference<_Tp>::type,
+              typename add_lvalue_reference<typename add_const<_Tp>::type>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_nothrow_copy_constructible.h b/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
index 966df860e4b8c..5f31da54a0bb9 100644
--- a/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
@@ -21,10 +21,23 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
+#ifdef _LIBCPP_COMPILER_GCC
+
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
     : public is_nothrow_constructible<_Tp,
                   typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
 
+#else // _LIBCPP_COMPILER_GCC
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
+    : public integral_constant<
+          bool,
+          __is_nothrow_constructible(_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type)> {};
+
+#endif // _LIBCPP_COMPILER_GCC
+
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
 inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value;

diff  --git a/libcxx/include/__type_traits/is_nothrow_default_constructible.h b/libcxx/include/__type_traits/is_nothrow_default_constructible.h
index addf359ec3d67..91bffa5e466ee 100644
--- a/libcxx/include/__type_traits/is_nothrow_default_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_default_constructible.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_nothrow_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -20,12 +19,12 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible
-    : public is_nothrow_constructible<_Tp>
+    : public integral_constant<bool, __is_nothrow_constructible(_Tp)>
     {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value;
+inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcxx/include/__type_traits/is_nothrow_destructible.h
index 4763ae84086af..8df29c189e74b 100644
--- a/libcxx/include/__type_traits/is_nothrow_destructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_destructible.h
@@ -10,7 +10,6 @@
 #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DESTRUCTIBLE_H
 
 #include <__config>
-#include <__type_traits/add_const.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_destructible.h>
 #include <__type_traits/is_reference.h>

diff  --git a/libcxx/include/__type_traits/is_nothrow_move_assignable.h b/libcxx/include/__type_traits/is_nothrow_move_assignable.h
index 44cea1f9cd568..daf22695b5bf5 100644
--- a/libcxx/include/__type_traits/is_nothrow_move_assignable.h
+++ b/libcxx/include/__type_traits/is_nothrow_move_assignable.h
@@ -13,7 +13,6 @@
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/add_rvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_nothrow_assignable.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,10 +20,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
-    : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
-                                     typename add_rvalue_reference<_Tp>::type>
-    {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
+    : public integral_constant<
+          bool,
+          __is_nothrow_assignable(typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type)> {
+};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_nothrow_move_constructible.h b/libcxx/include/__type_traits/is_nothrow_move_constructible.h
index e3b1171a48266..84c2a45e9349c 100644
--- a/libcxx/include/__type_traits/is_nothrow_move_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_move_constructible.h
@@ -20,10 +20,21 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
+#ifndef _LIBCPP_COMPILER_GCC
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
+    : public integral_constant<bool, __is_nothrow_constructible(_Tp, typename add_rvalue_reference<_Tp>::type)>
+    {};
+
+#else // _LIBCPP_COMPILER_GCC
+
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
     : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
     {};
 
+#endif // _LIBCPP_COMPILER_GCC
+
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
 inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value;

diff  --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h
index 497060e005579..c1d00b269f009 100644
--- a/libcxx/include/__type_traits/is_pod.h
+++ b/libcxx/include/__type_traits/is_pod.h
@@ -18,24 +18,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if __has_builtin(__is_pod)
-
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
     : public integral_constant<bool, __is_pod(_Tp)> {};
 
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
-    : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value   &&
-                                     is_trivially_copy_constructible<_Tp>::value      &&
-                                     is_trivially_copy_assignable<_Tp>::value    &&
-                                     is_trivially_destructible<_Tp>::value> {};
-
-#endif // __has_builtin(__is_pod)
-
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_pod_v = is_pod<_Tp>::value;
+inline constexpr bool is_pod_v = __is_pod(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_standard_layout.h b/libcxx/include/__type_traits/is_standard_layout.h
index 0d8b5f480f0c5..12c17127482fa 100644
--- a/libcxx/include/__type_traits/is_standard_layout.h
+++ b/libcxx/include/__type_traits/is_standard_layout.h
@@ -19,16 +19,12 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
-#if __has_builtin(__is_standard_layout)
     : public integral_constant<bool, __is_standard_layout(_Tp)>
-#else
-    : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
+inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_trivial.h b/libcxx/include/__type_traits/is_trivial.h
index 73c2093d40820..840770d7b7ef8 100644
--- a/libcxx/include/__type_traits/is_trivial.h
+++ b/libcxx/include/__type_traits/is_trivial.h
@@ -19,17 +19,12 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
-#if __has_builtin(__is_trivial)
     : public integral_constant<bool, __is_trivial(_Tp)>
-#else
-    : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
-                                 is_trivially_default_constructible<_Tp>::value>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
+inline constexpr bool is_trivial_v = __is_trivial(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_trivially_assignable.h b/libcxx/include/__type_traits/is_trivially_assignable.h
index 01540f959efe3..9ef101f04ea7b 100644
--- a/libcxx/include/__type_traits/is_trivially_assignable.h
+++ b/libcxx/include/__type_traits/is_trivially_assignable.h
@@ -25,7 +25,7 @@ struct is_trivially_assignable
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp, class _Arg>
-inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value;
+inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_Tp, _Arg);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_trivially_constructible.h b/libcxx/include/__type_traits/is_trivially_constructible.h
index 92ea58005f845..4173e3b4cf6d6 100644
--- a/libcxx/include/__type_traits/is_trivially_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_constructible.h
@@ -26,7 +26,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp, class... _Args>
-inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value;
+inline constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Tp, _Args...);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_trivially_copy_assignable.h b/libcxx/include/__type_traits/is_trivially_copy_assignable.h
index 066d763884b09..820e4c12c783b 100644
--- a/libcxx/include/__type_traits/is_trivially_copy_assignable.h
+++ b/libcxx/include/__type_traits/is_trivially_copy_assignable.h
@@ -13,7 +13,6 @@
 #include <__type_traits/add_const.h>
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_trivially_assignable.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,9 +20,13 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable
-    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
-                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable
+    : public integral_constant<
+          bool,
+          __is_trivially_assignable(
+              typename add_lvalue_reference<_Tp>::type,
+              typename add_lvalue_reference<typename add_const<_Tp>::type>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_trivially_copy_constructible.h b/libcxx/include/__type_traits/is_trivially_copy_constructible.h
index e0c054d775d69..daa66cd4554d7 100644
--- a/libcxx/include/__type_traits/is_trivially_copy_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_copy_constructible.h
@@ -12,7 +12,6 @@
 #include <__config>
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_trivially_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,7 +20,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible
-    : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type>
+    : public integral_constant<bool, __is_trivially_constructible(_Tp, typename add_lvalue_reference<const _Tp>::type)>
     {};
 
 #if _LIBCPP_STD_VER > 14

diff  --git a/libcxx/include/__type_traits/is_trivially_copyable.h b/libcxx/include/__type_traits/is_trivially_copyable.h
index 3b7665217292f..ef118bf9c49ad 100644
--- a/libcxx/include/__type_traits/is_trivially_copyable.h
+++ b/libcxx/include/__type_traits/is_trivially_copyable.h
@@ -24,7 +24,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
+inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_trivially_default_constructible.h b/libcxx/include/__type_traits/is_trivially_default_constructible.h
index 822fa9c910c94..5c53bd55d904c 100644
--- a/libcxx/include/__type_traits/is_trivially_default_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_default_constructible.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_trivially_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -20,12 +19,12 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible
-    : public is_trivially_constructible<_Tp>
+    : public integral_constant<bool, __is_trivially_constructible(_Tp)>
     {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
-inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value;
+inline constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Tp);
 #endif
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/is_trivially_destructible.h b/libcxx/include/__type_traits/is_trivially_destructible.h
index 3376c3eeff43b..6639e29af59ad 100644
--- a/libcxx/include/__type_traits/is_trivially_destructible.h
+++ b/libcxx/include/__type_traits/is_trivially_destructible.h
@@ -30,15 +30,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
 
 #else
 
-template <class _Tp> struct __libcpp_trivial_destructor
-    : public integral_constant<bool, is_scalar<_Tp>::value ||
-                                     is_reference<_Tp>::value> {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
-    : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[]>
-    : public false_type {};
+#error is_trivially_destructible is not implemented
 
 #endif // __has_builtin(__is_trivially_destructible)
 

diff  --git a/libcxx/include/__type_traits/is_trivially_move_assignable.h b/libcxx/include/__type_traits/is_trivially_move_assignable.h
index fc033a40dea8e..d4839ea9bdbb9 100644
--- a/libcxx/include/__type_traits/is_trivially_move_assignable.h
+++ b/libcxx/include/__type_traits/is_trivially_move_assignable.h
@@ -13,7 +13,6 @@
 #include <__type_traits/add_lvalue_reference.h>
 #include <__type_traits/add_rvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_trivially_assignable.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -21,10 +20,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable
-    : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
-                                     typename add_rvalue_reference<_Tp>::type>
-    {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable
+    : public integral_constant<
+          bool,
+          __is_trivially_assignable(
+              typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_trivially_move_constructible.h b/libcxx/include/__type_traits/is_trivially_move_constructible.h
index be005cc264061..b9ee637606796 100644
--- a/libcxx/include/__type_traits/is_trivially_move_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_move_constructible.h
@@ -12,7 +12,6 @@
 #include <__config>
 #include <__type_traits/add_rvalue_reference.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_trivially_constructible.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -20,9 +19,9 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible
-    : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
-    {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible
+    : public integral_constant<bool, __is_trivially_constructible(_Tp, typename add_rvalue_reference<_Tp>::type)> {};
 
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>

diff  --git a/libcxx/include/__type_traits/is_union.h b/libcxx/include/__type_traits/is_union.h
index 3e8cffe034d4d..998aedd1428da 100644
--- a/libcxx/include/__type_traits/is_union.h
+++ b/libcxx/include/__type_traits/is_union.h
@@ -11,7 +11,6 @@
 
 #include <__config>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/remove_cv.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header

diff  --git a/libcxx/include/__type_traits/negation.h b/libcxx/include/__type_traits/negation.h
index 92f205fb838ec..b72f285a4d5dc 100644
--- a/libcxx/include/__type_traits/negation.h
+++ b/libcxx/include/__type_traits/negation.h
@@ -25,7 +25,7 @@ struct _Not : _BoolConstant<!_Pred::value> {};
 template <class _Tp>
 struct negation : _Not<_Tp> {};
 template<class _Tp>
-inline constexpr bool negation_v = negation<_Tp>::value;
+inline constexpr bool negation_v = !_Tp::value;
 #endif // _LIBCPP_STD_VER > 14
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__type_traits/rank.h b/libcxx/include/__type_traits/rank.h
index 193d3fd129a15..9950907b22780 100644
--- a/libcxx/include/__type_traits/rank.h
+++ b/libcxx/include/__type_traits/rank.h
@@ -19,6 +19,14 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// TODO: Enable using the builtin __array_rank when https://llvm.org/PR57133 is resolved
+#if __has_builtin(__array_rank) && 0
+
+template <class _Tp>
+struct rank : integral_constant<size_t, __array_rank(_Tp)> {};
+
+#else
+
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank
     : public integral_constant<size_t, 0> {};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]>
@@ -26,6 +34,8 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]>
 template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]>
     : public integral_constant<size_t, rank<_Tp>::value + 1> {};
 
+#endif // __has_builtin(__array_rank)
+
 #if _LIBCPP_STD_VER > 14
 template <class _Tp>
 inline constexpr size_t rank_v = rank<_Tp>::value;

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h
new file mode 100644
index 0000000000000..be9149de89a6c
--- /dev/null
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_META_UNARY_COMP_COMMON_H
+#define TEST_META_UNARY_COMP_COMMON_H
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
+struct TrivialNotNoexcept {
+  TrivialNotNoexcept() noexcept(false)                                     = default;
+  TrivialNotNoexcept(const TrivialNotNoexcept&) noexcept(false)            = default;
+  TrivialNotNoexcept(TrivialNotNoexcept&&) noexcept(false)                 = default;
+  TrivialNotNoexcept& operator=(const TrivialNotNoexcept&) noexcept(false) = default;
+  TrivialNotNoexcept& operator=(TrivialNotNoexcept&&) noexcept(false)      = default;
+};
+#endif
+
+class Empty {};
+
+struct NotEmpty {
+  virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero {
+  int : 0;
+};
+
+struct A {
+  A();
+  A(const A&);
+  A& operator=(const A&);
+};
+
+class Abstract
+{
+    virtual ~Abstract() = 0;
+};
+
+#endif // TEST_META_UNARY_COMP_COMMON_H

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
index 0d171261a5973..ad960d87f2b82 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
@@ -14,6 +14,8 @@
 #include <type_traits>
 #include "test_macros.h"
 
+#include "common.h"
+
 template <class T>
 void test_is_nothrow_constructible()
 {
@@ -59,32 +61,6 @@ void test_is_not_nothrow_constructible()
 #endif
 }
 
-class Empty
-{
-};
-
-class NotEmpty
-{
-    virtual ~NotEmpty();
-};
-
-union Union {};
-
-struct bit_zero
-{
-    int :  0;
-};
-
-class Abstract
-{
-    virtual ~Abstract() = 0;
-};
-
-struct A
-{
-    A(const A&);
-};
-
 struct C
 {
     C(C&);  // not const

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
index 64895adf45c46..61852ba698b18 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
@@ -13,6 +13,8 @@
 #include <type_traits>
 #include "test_macros.h"
 
+#include "common.h"
+
 template <class T>
 void test_has_nothrow_assign()
 {
@@ -31,27 +33,6 @@ void test_has_not_nothrow_assign()
 #endif
 }
 
-class Empty
-{
-};
-
-struct NotEmpty
-{
-    virtual ~NotEmpty();
-};
-
-union Union {};
-
-struct bit_zero
-{
-    int :  0;
-};
-
-struct A
-{
-    A& operator=(const A&);
-};
-
 int main(int, char**)
 {
     test_has_nothrow_assign<int&>();
@@ -64,6 +45,10 @@ int main(int, char**)
     test_has_nothrow_assign<NotEmpty>();
     test_has_nothrow_assign<bit_zero>();
 
+// TODO: enable the test for GCC once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is resolved
+#if TEST_STD_VER >= 11 && !defined(TEST_COMPILER_GCC)
+    test_has_not_nothrow_assign<TrivialNotNoexcept>();
+#endif
     test_has_not_nothrow_assign<const int>();
     test_has_not_nothrow_assign<void>();
     test_has_not_nothrow_assign<A>();

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
index 6b1708839ae2e..9e63bfeba6f18 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
@@ -13,6 +13,8 @@
 #include <type_traits>
 #include "test_macros.h"
 
+#include "common.h"
+
 template <class T>
 void test_is_nothrow_copy_constructible()
 {
@@ -39,26 +41,13 @@ void test_has_not_nothrow_copy_constructor()
 #endif
 }
 
-class Empty
-{
-};
-
-union Union {};
-
-struct bit_zero
-{
-    int :  0;
-};
-
-struct A
-{
-    A(const A&);
-};
-
 int main(int, char**)
 {
     test_has_not_nothrow_copy_constructor<void>();
     test_has_not_nothrow_copy_constructor<A>();
+#if TEST_STD_VER >= 11
+    test_has_not_nothrow_copy_constructor<TrivialNotNoexcept>();
+#endif
 
     test_is_nothrow_copy_constructible<int&>();
     test_is_nothrow_copy_constructible<Union>();

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
index c30facc516ba7..efe16bd5e45c7 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
@@ -13,6 +13,8 @@
 #include <type_traits>
 #include "test_macros.h"
 
+#include "common.h"
+
 template <class T>
 void test_is_nothrow_default_constructible()
 {
@@ -43,22 +45,6 @@ void test_has_not_nothrow_default_constructor()
 #endif
 }
 
-class Empty
-{
-};
-
-union Union {};
-
-struct bit_zero
-{
-    int :  0;
-};
-
-struct A
-{
-    A();
-};
-
 #if TEST_STD_VER >= 11
 struct DThrows
 {
@@ -74,6 +60,10 @@ int main(int, char**)
     test_has_not_nothrow_default_constructor<A>();
 #if TEST_STD_VER >= 11
     test_has_not_nothrow_default_constructor<DThrows>(); // This is LWG2116
+// TODO: enable the test for GCC once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is resolved
+#ifndef TEST_COMPILER_GCC
+    test_has_not_nothrow_default_constructor<TrivialNotNoexcept>();
+#endif
 #endif
 
     test_is_nothrow_default_constructible<Union>();

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
index 4bcbabbcc4add..61b21452f468e 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
@@ -13,6 +13,8 @@
 #include <type_traits>
 #include "test_macros.h"
 
+#include "common.h"
+
 template <class T>
 void test_has_nothrow_assign()
 {
@@ -31,27 +33,6 @@ void test_has_not_nothrow_assign()
 #endif
 }
 
-class Empty
-{
-};
-
-struct NotEmpty
-{
-    virtual ~NotEmpty();
-};
-
-union Union {};
-
-struct bit_zero
-{
-    int :  0;
-};
-
-struct A
-{
-    A& operator=(const A&);
-};
-
 int main(int, char**)
 {
     test_has_nothrow_assign<int&>();
@@ -66,6 +47,10 @@ int main(int, char**)
 
     test_has_not_nothrow_assign<void>();
     test_has_not_nothrow_assign<A>();
+// TODO: enable the test for GCC once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is resolved
+#if TEST_STD_VER >= 11 && !defined(TEST_COMPILER_GCC)
+    test_has_not_nothrow_assign<TrivialNotNoexcept>();
+#endif
 
   return 0;
 }

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp
index ab9e0c6bb4fae..dc10ec37b0fcd 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp
@@ -13,6 +13,8 @@
 #include <type_traits>
 #include "test_macros.h"
 
+#include "common.h"
+
 template <class T>
 void test_is_nothrow_move_constructible()
 {
@@ -39,26 +41,14 @@ void test_has_not_nothrow_move_constructor()
 #endif
 }
 
-class Empty
-{
-};
-
-union Union {};
-
-struct bit_zero
-{
-    int :  0;
-};
-
-struct A
-{
-    A(const A&);
-};
-
 int main(int, char**)
 {
     test_has_not_nothrow_move_constructor<void>();
     test_has_not_nothrow_move_constructor<A>();
+// TODO: enable the test for GCC once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is resolved
+#if TEST_STD_VER >= 11 && !defined(TEST_COMPILER_GCC)
+    test_has_not_nothrow_move_constructor<TrivialNotNoexcept>();
+#endif
 
     test_is_nothrow_move_constructible<int&>();
     test_is_nothrow_move_constructible<Union>();


        


More information about the libcxx-commits mailing list