summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/shared_ptr.h
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2016-11-14 15:42:40 +0100
committerRichard Guenther <rguenther@suse.de>2016-11-14 15:42:40 +0100
commitca94f8c64654980144e88fb19b04adf5f023aa55 (patch)
treeef90f8461d210f78e7f7b0ba89923a5eda7b3758 /libstdc++-v3/include/bits/shared_ptr.h
parent9e872f3fe8b4f6624e2edf5ee55a833e53f290c8 (diff)
parent5dc46e164993bbf658f61069823a1b37a2d715eb (diff)
downloadgcc-gimplefe.tar.gz
Merge remote-tracking branch 'trunk' of git://gcc.gnu.org/git/gcc into gimplefegimplefe
Diffstat (limited to 'libstdc++-v3/include/bits/shared_ptr.h')
-rw-r--r--libstdc++-v3/include/bits/shared_ptr.h14
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