diff options
Diffstat (limited to 'libstdc++-v3/include/bits/shared_ptr.h')
-rw-r--r-- | libstdc++-v3/include/bits/shared_ptr.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h index 9f7a40c5e1e..cbe4144359e 100644 --- a/libstdc++-v3/include/bits/shared_ptr.h +++ b/libstdc++-v3/include/bits/shared_ptr.h @@ -277,6 +277,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION shared_ptr(unique_ptr<_Yp, _Del>&& __r) : __shared_ptr<_Tp>(std::move(__r)) { } +#if __cplusplus <= 201402L && _GLIBCXX_USE_DEPRECATED + // This non-standard constructor exists to support conversions that + // were possible in C++11 and C++14 but are ill-formed in C++17. + // If an exception is thrown this constructor has no effect. + template<typename _Yp, typename _Del, + _Constructible<unique_ptr<_Yp, _Del>, __sp_array_delete>* = 0> + shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : __shared_ptr<_Tp>(std::move(__r), __sp_array_delete()) { } +#endif + /** * @brief Construct an empty %shared_ptr. * @post use_count() == 0 && get() == nullptr @@ -692,7 +702,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { size_t operator()(const shared_ptr<_Tp>& __s) const noexcept - { return std::hash<_Tp*>()(__s.get()); } + { + return std::hash<typename shared_ptr<_Tp>::element_type*>()(__s.get()); + } }; // @} group pointer_abstractions |