diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2016-10-16 20:12:52 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2016-10-16 20:12:52 +0200 |
commit | 493a6a7da66b065821b3a22446968b272b5c45bc (patch) | |
tree | 3984391651c53c8a35beebf2446111c0dfb5d72a /libstdc++-v3/include | |
parent | fe89a30c89f79a4ddbb0c22c4ceaf6a1b2e34197 (diff) |
Merge branches/gcc-6-branch rev 241214.
Change-Id: I2fc7e5fc01a9015199e9be293b8a7b503fd5a829
Diffstat (limited to 'libstdc++-v3/include')
40 files changed, 388 insertions, 159 deletions
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 9cd6a85b9a2..1ef6d2a5469 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -681,6 +681,7 @@ experimental_bits_srcdir = ${glibcxx_srcdir}/include/experimental/bits experimental_bits_builddir = ./experimental/bits experimental_bits_headers = \ ${experimental_bits_srcdir}/erase_if.h \ + ${experimental_bits_srcdir}/lfts_config.h \ ${experimental_bits_srcdir}/shared_ptr.h \ ${experimental_bits_srcdir}/string_view.tcc \ ${experimental_bits_filesystem_headers} diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 43735f9174c..751f16b037e 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -970,6 +970,7 @@ experimental_bits_srcdir = ${glibcxx_srcdir}/include/experimental/bits experimental_bits_builddir = ./experimental/bits experimental_bits_headers = \ ${experimental_bits_srcdir}/erase_if.h \ + ${experimental_bits_srcdir}/lfts_config.h \ ${experimental_bits_srcdir}/shared_ptr.h \ ${experimental_bits_srcdir}/string_view.tcc \ ${experimental_bits_filesystem_headers} diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 374c9851539..f8f3f88cc56 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -5698,6 +5698,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; #endif +_GLIBCXX_END_NAMESPACE_VERSION + #if __cplusplus > 201103L #define __cpp_lib_string_udls 201304 @@ -5706,6 +5708,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { inline namespace string_literals { +_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_DEFAULT_ABI_TAG inline basic_string<char> @@ -5731,12 +5734,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return basic_string<char32_t>{__str, __len}; } #endif +_GLIBCXX_END_NAMESPACE_VERSION } // inline namespace string_literals } // inline namespace literals #endif // __cplusplus > 201103L -_GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++11 diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 46256074251..560d0ebd106 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -179,8 +179,11 @@ namespace placeholders { } namespace regex_constants { } namespace this_thread { } - - namespace experimental { } + inline namespace literals { + inline namespace chrono_literals { } + inline namespace complex_literals { } + inline namespace string_literals { } + } } namespace abi { } @@ -265,7 +268,11 @@ namespace std namespace regex_constants { inline namespace __7 { } } namespace this_thread { inline namespace __7 { } } - namespace experimental { inline namespace __7 { } } + inline namespace literals { + inline namespace chrono_literals { inline namespace __7 { } } + inline namespace complex_literals { inline namespace __7 { } } + inline namespace string_literals { inline namespace __7 { } } + } namespace __detail { inline namespace __7 { } } } diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 4e87bc0088b..a7d45e6edc4 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -769,10 +769,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, __detail::_RegexExecutorPolicy, bool> - friend bool - __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); + friend bool __detail:: +#if _GLIBCXX_INLINE_VERSION + __7:: // Required due to PR c++/59256 +#endif + __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); template<typename, typename, typename, bool> friend class __detail::_Executor; @@ -1860,10 +1863,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, __detail::_RegexExecutorPolicy, bool> - friend bool - __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); + friend bool __detail:: +#if _GLIBCXX_INLINE_VERSION + __7:: // Required due to PR c++/59256 +#endif + __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); void _M_resize(unsigned int __size) diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 3401cd0fb73..17e6ff0691a 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -324,9 +324,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !(__x < __y); } template<typename _Iterator> +#if __cplusplus < 201103L inline typename reverse_iterator<_Iterator>::difference_type operator-(const reverse_iterator<_Iterator>& __x, const reverse_iterator<_Iterator>& __y) +#else + inline auto + operator-(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + -> decltype(__x.base() - __y.base()) +#endif { return __y.base() - __x.base(); } template<typename _Iterator> diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index b2595092060..f2934838098 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -160,9 +160,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ map() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<allocator_type>::value) -#endif + _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<allocator_type>::value + && is_nothrow_default_constructible<key_compare>::value) : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 94ebf6ebc89..d48935e56d3 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -158,9 +158,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ multimap() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<allocator_type>::value) -#endif + _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<allocator_type>::value + && is_nothrow_default_constructible<key_compare>::value) : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index cc13b3cea38..03a3e7dc861 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -138,9 +138,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ multiset() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<allocator_type>::value) -#endif + _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<allocator_type>::value + && is_nothrow_default_constructible<key_compare>::value) : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 37ee5cc4053..87824f0c1bd 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -88,52 +88,95 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Concept utility functions, reused in conditionally-explicit // constructors. // See PR 70437, don't look at is_constructible or - // is_convertible if the decayed types are the same to + // is_convertible if the types are the same to // avoid querying those properties for incomplete types. - template <typename _T1, typename _T2, typename _U1, typename _U2> - constexpr bool _ConstructiblePair() - { - return __and_<__or_<is_same<typename decay<_T1>::type, - typename decay<_U1>::type>, - is_constructible<_T1, const _U1&>>, - __or_<is_same<typename decay<_T2>::type, - typename decay<_U2>::type>, - is_constructible<_T2, const _U2&>>>::value; - } - - template <typename _T1, typename _T2, typename _U1, typename _U2> - constexpr bool _ImplicitlyConvertiblePair() - { - return __and_<__or_<is_same<typename decay<_T1>::type, - typename decay<_U1>::type>, - is_convertible<const _U1&, _T1>>, - __or_<is_same<typename decay<_T2>::type, - typename decay<_U2>::type>, - is_convertible<const _U2&, _T2>>>::value; - } - - template <typename _T1, typename _T2, typename _U1, typename _U2> - constexpr bool _MoveConstructiblePair() - { - return __and_<__or_<is_same<typename decay<_T1>::type, - typename decay<_U1>::type>, - is_constructible<_T1, _U1&&>>, - __or_<is_same<typename decay<_T2>::type, - typename decay<_U2>::type>, - is_constructible<_T2, _U2&&>>>::value; - } - - template <typename _T1, typename _T2, typename _U1, typename _U2> - constexpr bool _ImplicitlyMoveConvertiblePair() - { - return __and_<__or_<is_same<typename decay<_T1>::type, - typename decay<_U1>::type>, - is_convertible<_U1&&, _T1>>, - __or_<is_same<typename decay<_T2>::type, - typename decay<_U2>::type>, - is_convertible<_U2&&, _T2>>>::value; - } + template <bool, typename _T1, typename _T2> + struct _PCC + { + template <typename _U1, typename _U2> + static constexpr bool _ConstructiblePair() + { + return __and_<is_constructible<_T1, const _U1&>, + is_constructible<_T2, const _U2&>>::value; + } + + template <typename _U1, typename _U2> + static constexpr bool _ImplicitlyConvertiblePair() + { + return __and_<is_convertible<const _U1&, _T1>, + is_convertible<const _U2&, _T2>>::value; + } + + template <typename _U1, typename _U2> + static constexpr bool _MoveConstructiblePair() + { + return __and_<is_constructible<_T1, _U1&&>, + is_constructible<_T2, _U2&&>>::value; + } + template <typename _U1, typename _U2> + static constexpr bool _ImplicitlyMoveConvertiblePair() + { + return __and_<is_convertible<_U1&&, _T1>, + is_convertible<_U2&&, _T2>>::value; + } + + template <bool __implicit, typename _U1, typename _U2> + static constexpr bool _CopyMovePair() + { + using __do_converts = __and_<is_convertible<const _U1&, _T1>, + is_convertible<_U2&&, _T2>>; + using __converts = typename conditional<__implicit, + __do_converts, + __not_<__do_converts>>::type; + return __and_<is_constructible<_T1, const _U1&>, + is_constructible<_T2, _U2&&>, + __converts + >::value; + } + + template <bool __implicit, typename _U1, typename _U2> + static constexpr bool _MoveCopyPair() + { + using __do_converts = __and_<is_convertible<_U1&&, _T1>, + is_convertible<const _U2&, _T2>>; + using __converts = typename conditional<__implicit, + __do_converts, + __not_<__do_converts>>::type; + return __and_<is_constructible<_T1, _U1&&>, + is_constructible<_T2, const _U2&&>, + __converts + >::value; + } + }; + + template <typename _T1, typename _T2> + struct _PCC<false, _T1, _T2> + { + template <typename _U1, typename _U2> + static constexpr bool _ConstructiblePair() + { + return false; + } + + template <typename _U1, typename _U2> + static constexpr bool _ImplicitlyConvertiblePair() + { + return false; + } + + template <typename _U1, typename _U2> + static constexpr bool _MoveConstructiblePair() + { + return false; + } + + template <typename _U1, typename _U2> + static constexpr bool _ImplicitlyMoveConvertiblePair() + { + return false; + } + }; #endif @@ -186,16 +229,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } #else + // Shortcut for constraining the templates that don't take pairs. + using _PCCP = _PCC<true, _T1, _T2>; + template<typename _U1 = _T1, typename _U2=_T2, typename - enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>() - && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), + enable_if<_PCCP::template + _ConstructiblePair<_U1, _U2>() + && _PCCP::template + _ImplicitlyConvertiblePair<_U1, _U2>(), bool>::type=true> constexpr pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } template<typename _U1 = _T1, typename _U2=_T2, typename - enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>() - && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), + enable_if<_PCCP::template + _ConstructiblePair<_U1, _U2>() + && !_PCCP::template + _ImplicitlyConvertiblePair<_U1, _U2>(), bool>::type=false> explicit constexpr pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) { } @@ -207,16 +257,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) { } #else + // Shortcut for constraining the templates that take pairs. + template <typename _U1, typename _U2> + using _PCCFP = _PCC<!is_same<_T1, _U1>::value + || !is_same<_T2, _U2>::value, + _T1, _T2>; + template<typename _U1, typename _U2, typename - enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>() - && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), - bool>::type=true> + enable_if<_PCCFP<_U1, _U2>::template + _ConstructiblePair<_U1, _U2>() + && _PCCFP<_U1, _U2>::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=true> constexpr pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) { } template<typename _U1, typename _U2, typename - enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>() - && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(), + enable_if<_PCCFP<_U1, _U2>::template + _ConstructiblePair<_U1, _U2>() + && !_PCCFP<_U1, _U2>::template + _ImplicitlyConvertiblePair<_U1, _U2>(), bool>::type=false> explicit constexpr pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) { } @@ -226,75 +286,67 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // DR 811. template<typename _U1, typename - enable_if<_ConstructiblePair<_T2, _T2, _T2, _T2>() - && _MoveConstructiblePair<_T1, _T2, _U1, _T2>() - && _ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>() - && _ImplicitlyMoveConvertiblePair<_T1, _T2, - _U1, _T2>(), + enable_if<_PCCP::template + _MoveCopyPair<true, _U1, _T2>(), bool>::type=true> constexpr pair(_U1&& __x, const _T2& __y) : first(std::forward<_U1>(__x)), second(__y) { } template<typename _U1, typename - enable_if<_ConstructiblePair<_T2, _T2, _T2, _T2>() - && _MoveConstructiblePair<_T1, _T2, _U1, _T2>() - && (!_ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>() - || !_ImplicitlyMoveConvertiblePair<_T1, _T2, - _U1, _T2>()), + enable_if<_PCCP::template + _MoveCopyPair<false, _U1, _T2>(), bool>::type=false> explicit constexpr pair(_U1&& __x, const _T2& __y) : first(std::forward<_U1>(__x)), second(__y) { } template<typename _U2, typename - enable_if<_ConstructiblePair<_T1, _T1, _T1, _T1>() - && _MoveConstructiblePair<_T1, _T2, _T1, _U2>() - && _ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>() - && _ImplicitlyMoveConvertiblePair<_T1, _T2, - _T1, _U2>(), + enable_if<_PCCP::template + _CopyMovePair<true, _T1, _U2>(), bool>::type=true> constexpr pair(const _T1& __x, _U2&& __y) : first(__x), second(std::forward<_U2>(__y)) { } template<typename _U2, typename - enable_if<_ConstructiblePair<_T1, _T1, _T1, _T1>() - && _MoveConstructiblePair<_T1, _T2, _T1, _U2>() - && (!_ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>() - || !_ImplicitlyMoveConvertiblePair<_T1, _T2, - _T1, _U2>()), + enable_if<_PCCP::template + _CopyMovePair<false, _T1, _U2>(), bool>::type=false> explicit pair(const _T1& __x, _U2&& __y) : first(__x), second(std::forward<_U2>(__y)) { } template<typename _U1, typename _U2, typename - enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>() - && _ImplicitlyMoveConvertiblePair<_T1, _T2, - _U1, _U2>(), + enable_if<_PCCP::template + _MoveConstructiblePair<_U1, _U2>() + && _PCCP::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), bool>::type=true> constexpr pair(_U1&& __x, _U2&& __y) : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } template<typename _U1, typename _U2, typename - enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>() - && !_ImplicitlyMoveConvertiblePair<_T1, _T2, - _U1, _U2>(), + enable_if<_PCCP::template + _MoveConstructiblePair<_U1, _U2>() + && !_PCCP::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), bool>::type=false> explicit constexpr pair(_U1&& __x, _U2&& __y) : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } template<typename _U1, typename _U2, typename - enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>() - && _ImplicitlyMoveConvertiblePair<_T1, _T2, - _U1, _U2>(), + enable_if<_PCCFP<_U1, _U2>::template + _MoveConstructiblePair<_U1, _U2>() + && _PCCFP<_U1, _U2>::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), bool>::type=true> constexpr pair(pair<_U1, _U2>&& __p) : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) { } template<typename _U1, typename _U2, typename - enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>() - && !_ImplicitlyMoveConvertiblePair<_T1, _T2, - _U1, _U2>(), + enable_if<_PCCFP<_U1, _U2>::template + _MoveConstructiblePair<_U1, _U2>() + && !_PCCFP<_U1, _U2>::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), bool>::type=false> explicit constexpr pair(pair<_U1, _U2>&& __p) : first(std::forward<_U1>(__p.first)), @@ -304,7 +356,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); pair& - operator=(const pair& __p) + operator=(typename conditional< + __and_<is_copy_assignable<_T1>, + is_copy_assignable<_T2>>::value, + const pair&, const __nonesuch&>::type __p) { first = __p.first; second = __p.second; @@ -312,7 +367,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } pair& - operator=(pair&& __p) + operator=(typename conditional< + __not_<__and_<is_copy_assignable<_T1>, + is_copy_assignable<_T2>>>::value, + const pair&, const __nonesuch&>::type __p) = delete; + + pair& + operator=(typename conditional< + __and_<is_move_assignable<_T1>, + is_move_assignable<_T2>>::value, + pair&&, __nonesuch&&>::type __p) noexcept(__and_<is_nothrow_move_assignable<_T1>, is_nothrow_move_assignable<_T2>>::value) { @@ -322,7 +386,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template<typename _U1, typename _U2> - pair& + typename enable_if<__and_<is_assignable<_T1&, const _U1&>, + is_assignable<_T2&, const _U2&>>::value, + pair&>::type operator=(const pair<_U1, _U2>& __p) { first = __p.first; @@ -331,7 +397,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template<typename _U1, typename _U2> - pair& + typename enable_if<__and_<is_assignable<_T1&, _U1&&>, + is_assignable<_T2&, _U2&&>>::value, + pair&>::type operator=(pair<_U1, _U2>&& __p) { first = std::forward<_U1>(__p.first); diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index 9caca03cd0e..5d255e7300b 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -449,28 +449,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Alloc, typename _Requires = _Uses<_Alloc>> explicit priority_queue(const _Alloc& __a) - : c(__a) { } + : c(__a), comp() { } template<typename _Alloc, typename _Requires = _Uses<_Alloc>> priority_queue(const _Compare& __x, const _Alloc& __a) - : c(__x, __a) { } + : c(__a), comp(__x) { } template<typename _Alloc, typename _Requires = _Uses<_Alloc>> priority_queue(const _Compare& __x, const _Sequence& __c, const _Alloc& __a) - : c(__x, __c, __a) { } + : c(__c, __a), comp(__x) { } template<typename _Alloc, typename _Requires = _Uses<_Alloc>> priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) - : c(__x, std::move(__c), __a) { } + : c(std::move(__c), __a), comp(__x) { } template<typename _Alloc, typename _Requires = _Uses<_Alloc>> priority_queue(const priority_queue& __q, const _Alloc& __a) - : c(__q.c, __a) { } + : c(__q.c, __a), comp(__q.comp) { } template<typename _Alloc, typename _Requires = _Uses<_Alloc>> priority_queue(priority_queue&& __q, const _Alloc& __a) - : c(std::move(__q.c), __a) { } + : c(std::move(__q.c), __a), comp(std::move(__q.comp)) { } #endif /** diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index f5e0603d42d..d8cdcc5b292 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -140,9 +140,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @brief Default constructor creates no elements. */ set() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<allocator_type>::value) -#endif + _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<allocator_type>::value + && is_nothrow_default_constructible<key_compare>::value) : _M_t() { } /** diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 8697a711a5f..25580e4cc5c 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -1264,6 +1264,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // which might result in a copy not a move. void _M_move_data(_Rb_tree&, std::false_type); + + // Move assignment from container with equal allocator. + void + _M_move_assign(_Rb_tree&, std::true_type); + + // Move assignment from container with possibly non-equal allocator, + // which might result in a copy not a move. + void + _M_move_assign(_Rb_tree&, std::false_type); #endif }; @@ -1379,24 +1388,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& + inline void _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - operator=(_Rb_tree&& __x) - noexcept(_Alloc_traits::_S_nothrow_move() - && is_nothrow_move_assignable<_Compare>::value) + _M_move_assign(_Rb_tree& __x, true_type) { - _M_impl._M_key_compare = __x._M_impl._M_key_compare; - if (_Alloc_traits::_S_propagate_on_move_assign() - || _Alloc_traits::_S_always_equal() - || _M_get_Node_allocator() == __x._M_get_Node_allocator()) - { - clear(); - if (__x._M_root() != nullptr) - _M_move_data(__x, std::true_type()); - std::__alloc_on_move(_M_get_Node_allocator(), - __x._M_get_Node_allocator()); - return *this; - } + clear(); + if (__x._M_root() != nullptr) + _M_move_data(__x, std::true_type()); + std::__alloc_on_move(_M_get_Node_allocator(), + __x._M_get_Node_allocator()); + } + + template<typename _Key, typename _Val, typename _KeyOfValue, + typename _Compare, typename _Alloc> + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_move_assign(_Rb_tree& __x, false_type) + { + if (_M_get_Node_allocator() == __x._M_get_Node_allocator()) + return _M_move_assign(__x, true_type{}); // Try to move each node reusing existing nodes and copying __x nodes // structure. @@ -1416,6 +1426,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_impl._M_node_count = __x._M_impl._M_node_count; __x.clear(); } + } + + template<typename _Key, typename _Val, typename _KeyOfValue, + typename _Compare, typename _Alloc> + inline _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + operator=(_Rb_tree&& __x) + noexcept(_Alloc_traits::_S_nothrow_move() + && is_nothrow_move_assignable<_Compare>::value) + { + _M_impl._M_key_compare = __x._M_impl._M_key_compare; + constexpr bool __move_storage = + _Alloc_traits::_S_propagate_on_move_assign() + || _Alloc_traits::_S_always_equal(); + _M_move_assign(__x, __bool_constant<__move_storage>()); return *this; } diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h index 393aa77b7f0..c45d629f558 100644 --- a/libstdc++-v3/include/bits/uniform_int_dist.h +++ b/libstdc++-v3/include/bits/uniform_int_dist.h @@ -36,10 +36,10 @@ namespace std _GLIBCXX_VISIBILITY(default) { -_GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __detail { +_GLIBCXX_BEGIN_NAMESPACE_VERSION /* Determine whether number is a power of 2. */ template<typename _Tp> inline bool @@ -47,8 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return ((__x - 1) & __x) == 0; }; +_GLIBCXX_END_NAMESPACE_VERSION } +_GLIBCXX_BEGIN_NAMESPACE_VERSION + /** * @brief Uniform discrete distribution for random numbers. * A discrete random distribution on the range @f$[min, max]@f$ with equal diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio index 920d109bcb8..86d524f96a6 100644 --- a/libstdc++-v3/include/c_global/cstdio +++ b/libstdc++-v3/include/c_global/cstdio @@ -44,7 +44,7 @@ #ifndef _GLIBCXX_CSTDIO #define _GLIBCXX_CSTDIO 1 -#ifndef _GLIBCXX_HAVE_GETS +#if __cplusplus <= 201103L && !defined(_GLIBCXX_HAVE_GETS) extern "C" char* gets (char* __s) __attribute__((__deprecated__)); #endif diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio index a4119ba6c64..549004c0a16 100644 --- a/libstdc++-v3/include/c_std/cstdio +++ b/libstdc++-v3/include/c_std/cstdio @@ -44,7 +44,7 @@ #include <bits/c++config.h> #include <stdio.h> -#ifndef _GLIBCXX_HAVE_GETS +#if __cplusplus <= 201103L && !defined(_GLIBCXX_HAVE_GETS) extern "C" char* gets (char* __s) __attribute__((__deprecated__)); #endif diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index 5368f3b9a2d..3f5a7f818b8 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -296,7 +296,7 @@ namespace __gnu_debug _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); - __gnu_cxx::__scoped_lock(this->_M_get_mutex()); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); ++base(); return *this; } diff --git a/libstdc++-v3/include/experimental/algorithm b/libstdc++-v3/include/experimental/algorithm index 9083c7fa51a..0ba6311e952 100644 --- a/libstdc++-v3/include/experimental/algorithm +++ b/libstdc++-v3/include/experimental/algorithm @@ -37,6 +37,7 @@ #include <algorithm> #include <random> +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index 96ad5762f66..5e091a45dda 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -39,6 +39,7 @@ #include <new> #include <utility> #include <type_traits> +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/bits/erase_if.h b/libstdc++-v3/include/experimental/bits/erase_if.h index b9aa63765c7..0ed60aa4749 100644 --- a/libstdc++-v3/include/experimental/bits/erase_if.h +++ b/libstdc++-v3/include/experimental/bits/erase_if.h @@ -35,6 +35,7 @@ #if __cplusplus <= 201103L # include <bits/c++14_warning.h> #else +#include <experimental/bits/lfts_config.h> namespace std { diff --git a/libstdc++-v3/include/experimental/bits/fs_fwd.h b/libstdc++-v3/include/experimental/bits/fs_fwd.h index 57aa4d3ee79..e7f2eb09816 100644 --- a/libstdc++-v3/include/experimental/bits/fs_fwd.h +++ b/libstdc++-v3/include/experimental/bits/fs_fwd.h @@ -46,10 +46,13 @@ namespace filesystem { inline namespace v1 { +#if _GLIBCXX_INLINE_VERSION +inline namespace __7 { } +#endif _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_CXX11_ABI - inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } #endif /** diff --git a/libstdc++-v3/include/experimental/bits/lfts_config.h b/libstdc++-v3/include/experimental/bits/lfts_config.h new file mode 100644 index 00000000000..10e36874de2 --- /dev/null +++ b/libstdc++-v3/include/experimental/bits/lfts_config.h @@ -0,0 +1,60 @@ +// Namespace declarations for Library Fundamentals TS -*- C++ -*- + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file experimental/bits/lfts_config.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#if __cplusplus <= 201103L +# include <bits/c++14_warning.h> +#else +#include <bits/c++config.h> + +#if _GLIBCXX_INLINE_VERSION +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace chrono +{ +namespace experimental +{ +inline namespace fundamentals_v1 { inline namespace __7 { } } +inline namespace fundamentals_v2 { inline namespace __7 { } } +} // namespace experimental +} // namespace chrono + +namespace experimental +{ +inline namespace fundamentals_v1 { inline namespace __7 { } } +inline namespace fundamentals_v2 { + inline namespace __7 { } + namespace pmr { inline namespace __7 { } } +} // namespace fundamentals_v2 +inline namespace literals { inline namespace string_view_literals { + inline namespace __7 { } +} } // namespace literals::string_view_literals +} // namespace experimental +} // namespace std +#endif +#endif diff --git a/libstdc++-v3/include/experimental/bits/string_view.tcc b/libstdc++-v3/include/experimental/bits/string_view.tcc index 3a16c38ea1c..7c6b1be32d9 100644 --- a/libstdc++-v3/include/experimental/bits/string_view.tcc +++ b/libstdc++-v3/include/experimental/bits/string_view.tcc @@ -44,6 +44,8 @@ namespace std _GLIBCXX_VISIBILITY(default) { namespace experimental { +inline namespace fundamentals_v1 +{ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> @@ -222,6 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION +} // namespace fundamentals_v1 } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/chrono b/libstdc++-v3/include/experimental/chrono index 30de1cf1e9e..e703d9364ef 100644 --- a/libstdc++-v3/include/experimental/chrono +++ b/libstdc++-v3/include/experimental/chrono @@ -40,7 +40,7 @@ #else #include <chrono> - +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/functional b/libstdc++-v3/include/experimental/functional index ed41f5a3982..6a21caf340a 100644 --- a/libstdc++-v3/include/experimental/functional +++ b/libstdc++-v3/include/experimental/functional @@ -45,6 +45,7 @@ #ifdef _GLIBCXX_PARALLEL # include <parallel/algorithm> // For std::__parallel::search #endif +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { @@ -386,7 +387,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: template<typename _Fn2> explicit - _Not_fn(_Fn2&& __fn) : _M_fn(std::forward<_Fn2>(__fn)) { } + _Not_fn(_Fn2&& __fn, int) : _M_fn(std::forward<_Fn2>(__fn)) { } _Not_fn(const _Not_fn& __fn) = default; _Not_fn(_Not_fn&& __fn) = default; @@ -430,7 +431,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION noexcept(std::is_nothrow_constructible<std::decay_t<_Fn>, _Fn&&>::value) { using __maybe_type = _Maybe_wrap_member_pointer<std::decay_t<_Fn>>; - return _Not_fn<typename __maybe_type::type>{std::forward<_Fn>(__fn)}; + return _Not_fn<typename __maybe_type::type>{std::forward<_Fn>(__fn), 0}; } _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource index ea8afb89e02..39187c50881 100644 --- a/libstdc++-v3/include/experimental/memory_resource +++ b/libstdc++-v3/include/experimental/memory_resource @@ -34,6 +34,7 @@ #include <atomic> #include <cstddef> #include <bits/alloc_traits.h> +#include <experimental/bits/lfts_config.h> namespace std { namespace experimental { diff --git a/libstdc++-v3/include/experimental/numeric b/libstdc++-v3/include/experimental/numeric index 21878f3a910..50897722682 100644 --- a/libstdc++-v3/include/experimental/numeric +++ b/libstdc++-v3/include/experimental/numeric @@ -39,8 +39,8 @@ # include <bits/c++14_warning.h> #else +#include <numeric> #include <experimental/type_traits> -#include <cmath> namespace std _GLIBCXX_VISIBILITY(default) { @@ -52,6 +52,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #define __cpp_lib_experimental_gcd_lcm 201411 + // std::abs is not constexpr and doesn't support unsigned integers. + template<typename _Tp> + constexpr + enable_if_t<__and_<is_integral<_Tp>, is_signed<_Tp>>::value, _Tp> + __abs(_Tp __val) + { return __val < 0 ? -__val : __val; } + + template<typename _Tp> + constexpr + enable_if_t<__and_<is_integral<_Tp>, is_unsigned<_Tp>>::value, _Tp> + __abs(_Tp __val) + { return __val; } + // Greatest common divisor template<typename _Mn, typename _Nn> constexpr common_type_t<_Mn, _Nn> @@ -60,8 +73,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert(is_integral<_Mn>::value, "arguments to gcd are integers"); static_assert(is_integral<_Nn>::value, "arguments to gcd are integers"); - return __m == 0 ? std::abs(__n) - : __n == 0 ? std::abs(__m) + return __m == 0 ? fundamentals_v2::__abs(__n) + : __n == 0 ? fundamentals_v2::__abs(__m) : fundamentals_v2::gcd(__n, __m % __n); } @@ -74,7 +87,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert(is_integral<_Nn>::value, "arguments to lcm are integers"); return (__m != 0 && __n != 0) - ? (std::abs(__m) / fundamentals_v2::gcd(__m, __n)) * std::abs(__n) + ? (fundamentals_v2::__abs(__m) / fundamentals_v2::gcd(__m, __n)) + * fundamentals_v2::__abs(__n) : 0; } diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index b6425b7d00e..35577188194 100644 --- a/libstdc++-v3/include/experimental/optional +++ b/libstdc++-v3/include/experimental/optional @@ -53,6 +53,7 @@ #include <bits/functexcept.h> #include <bits/functional_hash.h> #include <bits/enable_special_members.h> +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const index 75cd8c0a4bd..15ffe4ac6ad 100644 --- a/libstdc++-v3/include/experimental/propagate_const +++ b/libstdc++-v3/include/experimental/propagate_const @@ -37,6 +37,7 @@ #include <type_traits> #include <functional> +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/random b/libstdc++-v3/include/experimental/random index 370390a9533..039e45fd694 100644 --- a/libstdc++-v3/include/experimental/random +++ b/libstdc++-v3/include/experimental/random @@ -30,6 +30,7 @@ #define _GLIBCXX_EXPERIMENTAL_RANDOM 1 #include <random> +#include <experimental/bits/lfts_config.h> namespace std { namespace experimental { diff --git a/libstdc++-v3/include/experimental/ratio b/libstdc++-v3/include/experimental/ratio index 8ab45c1697f..d55f6ae3388 100644 --- a/libstdc++-v3/include/experimental/ratio +++ b/libstdc++-v3/include/experimental/ratio @@ -40,7 +40,7 @@ #else #include <ratio> - +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { @@ -49,6 +49,7 @@ namespace experimental inline namespace fundamentals_v1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION + // See C++14 §20.11.5, ratio comparison template <typename _R1, typename _R2> constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value; diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view index 7a89d440b2a..8cb8c1ffa1c 100644 --- a/libstdc++-v3/include/experimental/string_view +++ b/libstdc++-v3/include/experimental/string_view @@ -41,6 +41,7 @@ #include <string> #include <limits> +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { @@ -651,13 +652,12 @@ _GLIBCXX_END_NAMESPACE_VERSION namespace experimental { -_GLIBCXX_BEGIN_NAMESPACE_VERSION - // I added these EMSR. inline namespace literals { inline namespace string_view_literals { + _GLIBCXX_BEGIN_NAMESPACE_VERSION inline constexpr basic_string_view<char> operator""sv(const char* __str, size_t __len) @@ -679,10 +679,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return basic_string_view<char32_t>{__str, __len}; } #endif - } - } - -_GLIBCXX_END_NAMESPACE_VERSION + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace string_literals + } // namespace literals } // namespace experimental } // namespace std diff --git a/libstdc++-v3/include/experimental/system_error b/libstdc++-v3/include/experimental/system_error index 86549519960..5b286ee6b96 100644 --- a/libstdc++-v3/include/experimental/system_error +++ b/libstdc++-v3/include/experimental/system_error @@ -40,7 +40,7 @@ #else #include <system_error> - +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { @@ -49,12 +49,14 @@ namespace experimental inline namespace fundamentals_v1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION + // See C++14 §19.5, System error support template <typename _Tp> constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; template <typename _Tp> constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; + _GLIBCXX_END_NAMESPACE_VERSION } // namespace fundamentals_v1 } // namespace experimental diff --git a/libstdc++-v3/include/experimental/tuple b/libstdc++-v3/include/experimental/tuple index 81e91bda373..7127306b06c 100644 --- a/libstdc++-v3/include/experimental/tuple +++ b/libstdc++-v3/include/experimental/tuple @@ -37,6 +37,7 @@ #include <tuple> #include <functional> +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits index a21fcd8bbad..06f1023a139 100644 --- a/libstdc++-v3/include/experimental/type_traits +++ b/libstdc++-v3/include/experimental/type_traits @@ -40,7 +40,7 @@ #else #include <type_traits> - +#include <experimental/bits/lfts_config.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/utility b/libstdc++-v3/include/experimental/utility index 8948e93bc8f..77a161e314a 100644 --- a/libstdc++-v3/include/experimental/utility +++ b/libstdc++-v3/include/experimental/utility @@ -31,6 +31,7 @@ #include <utility> #include <bits/uses_allocator.h> +#include <experimental/bits/lfts_config.h> namespace std { namespace experimental { diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index ba492df5624..b0a6df9ce8f 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -788,6 +788,7 @@ _GLIBCXX_END_NAMESPACE_VERSION { inline namespace chrono_literals { + _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Rep, unsigned long long _Val> struct _Checked_integral_constant @@ -863,6 +864,7 @@ _GLIBCXX_END_NAMESPACE_VERSION operator""ns() { return __check_overflow<chrono::nanoseconds, _Digits...>(); } + _GLIBCXX_END_NAMESPACE_VERSION } // inline namespace chrono_literals } // inline namespace literals diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 9b7c1d7279e..8f9703a59c8 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1932,10 +1932,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION conj(_Tp __x) { return __x; } +_GLIBCXX_END_NAMESPACE_VERSION + #if __cplusplus > 201103L inline namespace literals { inline namespace complex_literals { +_GLIBCXX_BEGIN_NAMESPACE_VERSION #define __cpp_lib_complex_udls 201309 @@ -1963,12 +1966,12 @@ inline namespace complex_literals { operator""il(unsigned long long __num) { return std::complex<long double>{0.0L, static_cast<long double>(__num)}; } +_GLIBCXX_END_NAMESPACE_VERSION } // inline namespace complex_literals } // inline namespace literals #endif // C++14 -_GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 4f5b3c5c42d..6f95b4b5f29 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -1462,7 +1462,7 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) void (_Undefined_class::*_M_member_pointer)(); }; - union _Any_data + union [[gnu::may_alias]] _Any_data { void* _M_access() { return &_M_pod_data[0]; } const void* _M_access() const { return &_M_pod_data[0]; } diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 00df22e3eb2..584b842edcd 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -154,6 +154,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, !_Pp::value> { }; + struct __nonesuch { + __nonesuch() = delete; + ~__nonesuch() = delete; + __nonesuch(__nonesuch const&) = delete; + void operator=(__nonesuch const&) = delete; + }; + #if __cplusplus > 201402L #define __cpp_lib_logical_traits 201510 @@ -994,6 +1001,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION is_function<_From>>>::value> struct __is_base_to_derived_ref; + template<typename _Tp, typename... _Args> + struct is_constructible; + // Detect whether we have a downcast situation during // reference binding. template<typename _From, typename _To> @@ -1004,7 +1014,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename remove_cv<typename remove_reference<_To >::type>::type __dst_t; typedef __and_<__not_<is_same<__src_t, __dst_t>>, - is_base_of<__src_t, __dst_t>> type; + is_base_of<__src_t, __dst_t>, + __not_<is_constructible<__dst_t, _From>>> type; static constexpr bool value = type::value; }; |