diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-09-20 17:34:42 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-09-20 17:34:42 +0100 |
commit | f78958c9b421bba1f24d04ec47cfa3d999214b32 (patch) | |
tree | fcf362ffffff7cacb075e905ab7d59f11241fb65 | |
parent | 7ba0b15a7e552a6458a54b460752fd19f423170d (diff) | |
download | gcc-f78958c9b421bba1f24d04ec47cfa3d999214b32.zip gcc-f78958c9b421bba1f24d04ec47cfa3d999214b32.tar.gz gcc-f78958c9b421bba1f24d04ec47cfa3d999214b32.tar.bz2 |
Deprecate nested types in std::hash
* include/bits/c++config (_GLIBCXX17_DEPRECATED): Define.
* include/bits/functional_hash.h (__hash_base::result_type)
(__hash_base::argument_type): Add _GLIBCXX17_DEPRECATED.
* include/std/optional (hash<optional<T>>::result_type)
(hash<optional<T>>::argument_type): Add deprecated attribute.
(__is_fast_hash<hash<optional<T>>>): Add partial specialization.
* include/std/variant (hash<variant<Types...>>::result_type)
(hash<variant<Types...>>::argument_type): Add deprecated attribute.
(__is_fast_hash<hash<variant<Types...>>>): Add partial specialization.
From-SVN: r253017
-rw-r--r-- | libstdc++-v3/ChangeLog | 10 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/functional_hash.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/std/optional | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/std/variant | 13 |
5 files changed, 34 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5a2c960..023e7ae 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,15 @@ 2017-09-20 Jonathan Wakely <jwakely@redhat.com> + * include/bits/c++config (_GLIBCXX17_DEPRECATED): Define. + * include/bits/functional_hash.h (__hash_base::result_type) + (__hash_base::argument_type): Add _GLIBCXX17_DEPRECATED. + * include/std/optional (hash<optional<T>>::result_type) + (hash<optional<T>>::argument_type): Add deprecated attribute. + (__is_fast_hash<hash<optional<T>>>): Add partial specialization. + * include/std/variant (hash<variant<Types...>>::result_type) + (hash<variant<Types...>>::argument_type): Add deprecated attribute. + (__is_fast_hash<hash<variant<Types...>>>): Add partial specialization. + * libsupc++/exception_ptr.h (copy_exception): Remove deprecated non-standard function. diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index d5d1d24..21e3fbb 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -77,6 +77,7 @@ // Macros for deprecated attributes. // _GLIBCXX_USE_DEPRECATED // _GLIBCXX_DEPRECATED +// _GLIBCXX17_DEPRECATED #ifndef _GLIBCXX_USE_DEPRECATED # define _GLIBCXX_USE_DEPRECATED 1 #endif @@ -87,6 +88,12 @@ # define _GLIBCXX_DEPRECATED #endif +#if defined(__DEPRECATED) && (__cplusplus >= 201703L) +# define _GLIBCXX17_DEPRECATED [[__deprecated__]] +#else +# define _GLIBCXX17_DEPRECATED +#endif + // Macros for ABI tag attributes. #ifndef _GLIBCXX_ABI_TAG_CXX11 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h index 38be172..c093684 100644 --- a/libstdc++-v3/include/bits/functional_hash.h +++ b/libstdc++-v3/include/bits/functional_hash.h @@ -49,8 +49,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Result, typename _Arg> struct __hash_base { - typedef _Result result_type; - typedef _Arg argument_type; + typedef _Result result_type _GLIBCXX17_DEPRECATED; + typedef _Arg argument_type _GLIBCXX17_DEPRECATED; }; /// Primary class template hash. diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 2df9b54..e017eed 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -1028,10 +1028,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : private __poison_hash<remove_const_t<_Tp>>, public __optional_hash_call_base<_Tp> { - using result_type = size_t; - using argument_type = optional<_Tp>; + using result_type [[__deprecated__]] = size_t; + using argument_type [[__deprecated__]] = optional<_Tp>; }; + template<typename _Tp> + struct __is_fast_hash<hash<optional<_Tp>>> : __is_fast_hash<hash<_Tp>> + { }; + /// @} template <typename _Tp> optional(_Tp) -> optional<_Tp>; diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index ee2571b..8f574f6 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -1420,15 +1420,15 @@ namespace __variant variant<_Types...>, std::index_sequence_for<_Types...>>, public __variant_hash_call_base<_Types...> { - using result_type = size_t; - using argument_type = variant<_Types...>; + using result_type [[__deprecated__]] = size_t; + using argument_type [[__deprecated__]] = variant<_Types...>; }; template<> struct hash<monostate> { - using result_type = size_t; - using argument_type = monostate; + using result_type [[__deprecated__]] = size_t; + using argument_type [[__deprecated__]] = monostate; size_t operator()(const monostate& __t) const noexcept @@ -1438,6 +1438,11 @@ namespace __variant } }; + template<typename... _Types> + struct __is_fast_hash<hash<variant<_Types...>>> + : bool_constant<(__is_fast_hash<_Types>::value && ...)> + { }; + _GLIBCXX_END_NAMESPACE_VERSION } // namespace std |