diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2019-09-25 09:10:38 +0000 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2019-09-25 09:10:38 +0000 |
| commit | a3d337a9a7d00d82bb190c5e551181d3998f6b98 (patch) | |
| tree | 24894b738fba0f734957c9af632f5bc1f584276f /libcxx/include | |
| parent | 436d9881a9a87b2c4177831435e85c8f47ce9ab1 (diff) | |
| download | bcm5719-llvm-a3d337a9a7d00d82bb190c5e551181d3998f6b98.tar.gz bcm5719-llvm-a3d337a9a7d00d82bb190c5e551181d3998f6b98.zip | |
Revert r372777: [libc++] Implement LWG 2510 and its follow-ups
This also reverts:
- r372778: [libc++] Implement LWG 3158
- r372782: [libc++] Try fixing tests that fail on GCC 5 and older
- r372787: Purge mentions of GCC 4 from the test suite
Reason: the change breaks compilation of LLVM with libc++, for details see
http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html
llvm-svn: 372832
Diffstat (limited to 'libcxx/include')
| -rw-r--r-- | libcxx/include/__functional_base | 2 | ||||
| -rw-r--r-- | libcxx/include/__mutex_base | 6 | ||||
| -rw-r--r-- | libcxx/include/mutex | 6 | ||||
| -rw-r--r-- | libcxx/include/new | 4 | ||||
| -rw-r--r-- | libcxx/include/tuple | 58 | ||||
| -rw-r--r-- | libcxx/include/type_traits | 15 | ||||
| -rw-r--r-- | libcxx/include/utility | 32 |
7 files changed, 27 insertions, 96 deletions
diff --git a/libcxx/include/__functional_base b/libcxx/include/__functional_base index ca761c409b6..9587d7ab15a 100644 --- a/libcxx/include/__functional_base +++ b/libcxx/include/__functional_base @@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up, // allocator_arg_t -struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; +struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; diff --git a/libcxx/include/__mutex_base b/libcxx/include/__mutex_base index ed75c82380a..a4ac36161cb 100644 --- a/libcxx/include/__mutex_base +++ b/libcxx/include/__mutex_base @@ -66,9 +66,9 @@ public: static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow"); -struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; }; -struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; }; -struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; }; +struct _LIBCPP_TYPE_VIS defer_lock_t {}; +struct _LIBCPP_TYPE_VIS try_to_lock_t {}; +struct _LIBCPP_TYPE_VIS adopt_lock_t {}; #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) diff --git a/libcxx/include/mutex b/libcxx/include/mutex index 8fc3c61221b..dca62202db1 100644 --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -86,9 +86,9 @@ public: void unlock(); }; -struct defer_lock_t { explicit defer_lock_t() = default; }; -struct try_to_lock_t { explicit try_to_lock_t() = default; }; -struct adopt_lock_t { explicit adopt_lock_t() = default; }; +struct defer_lock_t {}; +struct try_to_lock_t {}; +struct adopt_lock_t {}; inline constexpr defer_lock_t defer_lock{}; inline constexpr try_to_lock_t try_to_lock{}; diff --git a/libcxx/include/new b/libcxx/include/new index 40d351e9b77..85e4c4b3fcf 100644 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -39,7 +39,7 @@ struct destroying_delete_t { // C++20 }; inline constexpr destroying_delete_t destroying_delete{}; // C++20 -struct nothrow_t { explicit nothrow_t() = default; }; +struct nothrow_t {}; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler(new_handler new_p) noexcept; @@ -126,7 +126,7 @@ namespace std // purposefully not using versioning namespace { #if !defined(_LIBCPP_ABI_VCRUNTIME) -struct _LIBCPP_TYPE_VIS nothrow_t { explicit nothrow_t() = default; }; +struct _LIBCPP_TYPE_VIS nothrow_t {}; extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; class _LIBCPP_EXCEPTION_ABI bad_alloc diff --git a/libcxx/include/tuple b/libcxx/include/tuple index c4cd3bc5495..32bc86913aa 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -19,7 +19,7 @@ namespace std template <class... T> class tuple { public: - explicit(see-below) constexpr tuple(); + constexpr tuple(); explicit(see-below) tuple(const T&...); // constexpr in C++14 template <class... U> explicit(see-below) tuple(U&&...); // constexpr in C++14 @@ -500,22 +500,9 @@ class _LIBCPP_TEMPLATE_VIS tuple struct _CheckArgsConstructor<true, _Dummy> { template <class ..._Args> - struct __enable_implicit_default - // In C++03, there's no way to implement the resolution of LWG2510. -#ifdef _LIBCPP_CXX03_LANG - : true_type -#else - : __all<__is_implicitly_default_constructible<_Args>::value...> -#endif - { }; - - template <class ..._Args> - struct __enable_explicit_default - : integral_constant<bool, - __all<is_default_constructible<_Args>::value...>::value && - !__enable_implicit_default<_Args...>::value - > - { }; + static constexpr bool __enable_default() { + return __all<is_default_constructible<_Args>::value...>::value; + } template <class ..._Args> static constexpr bool __enable_explicit() { @@ -654,29 +641,22 @@ class _LIBCPP_TEMPLATE_VIS tuple const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT; public: - template <bool _Dummy = true, _EnableIf< - _CheckArgsConstructor<_Dummy>::template __enable_implicit_default<_Tp...>::value - , void*> = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - tuple() - _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} - - template <bool _Dummy = true, _EnableIf< - _CheckArgsConstructor<_Dummy>::template __enable_explicit_default<_Tp...>::value - , void*> = nullptr> - explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - tuple() + template <bool _Dummy = true, class = typename enable_if< + _CheckArgsConstructor<_Dummy>::template __enable_default<_Tp...>() + >::type> + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} tuple(tuple const&) = default; tuple(tuple&&) = default; - template <class _AllocArgT, class _Alloc, bool _Dummy = true, _EnableIf< + template <class _AllocArgT, class _Alloc, bool _Dummy = true, class = _EnableIf< _And< _IsSame<allocator_arg_t, _AllocArgT>, - typename _CheckArgsConstructor<_Dummy>::template __enable_implicit_default<_Tp...> + __dependent_type<is_default_constructible<_Tp>, _Dummy>... >::value - , void*> = nullptr + > > _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) @@ -685,20 +665,6 @@ public: typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), __tuple_types<_Tp...>()) {} - template <class _AllocArgT, class _Alloc, bool _Dummy = true, _EnableIf< - _And< - _IsSame<allocator_arg_t, _AllocArgT>, - typename _CheckArgsConstructor<_Dummy>::template __enable_explicit_default<_Tp...> - >::value - , void*> = nullptr - > - explicit _LIBCPP_INLINE_VISIBILITY - tuple(_AllocArgT, _Alloc const& __a) - : __base_(allocator_arg_t(), __a, - __tuple_indices<>(), __tuple_types<>(), - typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), - __tuple_types<_Tp...>()) {} - template <bool _Dummy = true, typename enable_if < diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index cb3ed971110..ee178243181 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -2807,21 +2807,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_default_constructible_v = is_default_constructible<_Tp>::value; #endif -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp> -void __test_implicit_default_constructible(_Tp); - -template <class _Tp, class = void> -struct __is_implicitly_default_constructible - : false_type -{ }; - -template <class _Tp> -struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({}))> - : is_default_constructible<_Tp> -{ }; -#endif // !C++03 - // is_copy_constructible template <class _Tp> diff --git a/libcxx/include/utility b/libcxx/include/utility index c90d049cf7b..64599c8d55d 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -69,7 +69,7 @@ struct pair pair(const pair&) = default; pair(pair&&) = default; - explicit(see-below) constexpr pair(); + constexpr pair(); explicit(see-below) pair(const T1& x, const T2& y); // constexpr in C++14 template <class U, class V> explicit(see-below) pair(U&& x, V&& y); // constexpr in C++14 template <class U, class V> explicit(see-below) pair(const pair<U, V>& p); // constexpr in C++14 @@ -99,7 +99,7 @@ template <class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); -struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; +struct piecewise_construct_t { }; inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); template <class T> struct tuple_size; @@ -276,7 +276,7 @@ template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { r template <class _Tp> void as_const(const _Tp&&) = delete; #endif -struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; }; +struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { }; #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); #else @@ -335,21 +335,9 @@ struct _LIBCPP_TEMPLATE_VIS pair struct _CheckArgs { template <class _U1, class _U2> - static constexpr bool __enable_explicit_default() { + static constexpr bool __enable_default() { return is_default_constructible<_U1>::value - && is_default_constructible<_U2>::value - && !__enable_implicit_default<_U1, _U2>(); - } - - template <class _U1, class _U2> - static constexpr bool __enable_implicit_default() { - // In C++03, there's no way to implement the resolution of LWG2510. -#ifdef _LIBCPP_CXX03_LANG - return true; -#else - return __is_implicitly_default_constructible<_U1>::value - && __is_implicitly_default_constructible<_U2>::value; -#endif + && is_default_constructible<_U2>::value; } template <class _U1, class _U2> @@ -400,15 +388,7 @@ struct _LIBCPP_TEMPLATE_VIS pair >::type; template<bool _Dummy = true, _EnableB< - _CheckArgsDep<_Dummy>::template __enable_explicit_default<_T1, _T2>() - > = false> - explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && - is_nothrow_default_constructible<second_type>::value) - : first(), second() {} - - template<bool _Dummy = true, _EnableB< - _CheckArgsDep<_Dummy>::template __enable_implicit_default<_T1, _T2>() + _CheckArgsDep<_Dummy>::template __enable_default<_T1, _T2>() > = false> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && |

