|
13 | 13 | #include <__type_traits/add_lvalue_reference.h> |
14 | 14 | #include <__type_traits/add_rvalue_reference.h> |
15 | 15 | #include <__type_traits/integral_constant.h> |
16 | | -#include <__type_traits/is_constructible.h> |
17 | | -#include <__type_traits/is_reference.h> |
18 | | -#include <__utility/declval.h> |
19 | | -#include <cstddef> |
20 | 16 |
|
21 | 17 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
22 | 18 | # pragma GCC system_header |
23 | 19 | #endif |
24 | 20 |
|
25 | 21 | _LIBCPP_BEGIN_NAMESPACE_STD |
26 | 22 |
|
27 | | -// GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 |
28 | | -#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC) |
29 | | - |
30 | 23 | template < class _Tp, class... _Args> |
31 | 24 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible |
32 | 25 | : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {}; |
33 | | -#else |
34 | | - |
35 | | -template <bool, bool, class _Tp, class... _Args> |
36 | | -struct __libcpp_is_nothrow_constructible; |
37 | | - |
38 | | -template <class _Tp, class... _Args> |
39 | | -struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ false, _Tp, _Args...> |
40 | | - : public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))> {}; |
41 | | - |
42 | | -template <class _Tp> |
43 | | -void __implicit_conversion_to(_Tp) noexcept {} |
44 | | - |
45 | | -template <class _Tp, class _Arg> |
46 | | -struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ true, _Tp, _Arg> |
47 | | - : public integral_constant<bool, noexcept(std::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))> {}; |
48 | | - |
49 | | -template <class _Tp, bool _IsReference, class... _Args> |
50 | | -struct __libcpp_is_nothrow_constructible</*is constructible*/ false, _IsReference, _Tp, _Args...> : public false_type { |
51 | | -}; |
52 | | - |
53 | | -template <class _Tp, class... _Args> |
54 | | -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible |
55 | | - : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, |
56 | | - is_reference<_Tp>::value, |
57 | | - _Tp, |
58 | | - _Args...> {}; |
59 | | - |
60 | | -template <class _Tp, size_t _Ns> |
61 | | -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> |
62 | | - : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> {}; |
63 | | - |
64 | | -#endif // __has_builtin(__is_nothrow_constructible) |
65 | 26 |
|
66 | 27 | #if _LIBCPP_STD_VER >= 17 |
67 | 28 | template <class _Tp, class... _Args> |
68 | 29 | inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; |
69 | 30 | #endif |
70 | 31 |
|
71 | | -// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed |
72 | | -#ifdef _LIBCPP_COMPILER_GCC |
73 | | - |
74 | | -template <class _Tp> |
75 | | -struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible |
76 | | - : public is_nothrow_constructible<_Tp, __add_lvalue_reference_t<const _Tp> > {}; |
77 | | - |
78 | | -#else // _LIBCPP_COMPILER_GCC |
79 | | - |
80 | 32 | template <class _Tp> |
81 | 33 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible |
82 | 34 | : public integral_constant< bool, __is_nothrow_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {}; |
83 | 35 |
|
84 | | -#endif // _LIBCPP_COMPILER_GCC |
85 | | - |
86 | 36 | #if _LIBCPP_STD_VER >= 17 |
87 | 37 | template <class _Tp> |
88 | 38 | inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; |
89 | 39 | #endif |
90 | 40 |
|
91 | | -// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed |
92 | | -#ifndef _LIBCPP_COMPILER_GCC |
93 | | - |
94 | 41 | template <class _Tp> |
95 | 42 | struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible |
96 | 43 | : public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {}; |
97 | 44 |
|
98 | | -#else // _LIBCPP_COMPILER_GCC |
99 | | - |
100 | | -template <class _Tp> |
101 | | -struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible |
102 | | - : public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > {}; |
103 | | - |
104 | | -#endif // _LIBCPP_COMPILER_GCC |
105 | | - |
106 | 45 | #if _LIBCPP_STD_VER >= 17 |
107 | 46 | template <class _Tp> |
108 | 47 | inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; |
|
0 commit comments