Implement P0599: 'noexcept for hash functions'. Fix a couple of hash functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298573 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/memory b/include/memory
index c7f540b..8ef4588 100644
--- a/include/memory
+++ b/include/memory
@@ -3037,7 +3037,7 @@
typedef unique_ptr<_Tp, _Dp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
- result_type operator()(const argument_type& __ptr) const _NOEXCEPT
+ result_type operator()(const argument_type& __ptr) const
{
typedef typename argument_type::pointer pointer;
return hash<pointer>()(__ptr.get());
diff --git a/include/optional b/include/optional
index 180f63f..002842f 100644
--- a/include/optional
+++ b/include/optional
@@ -1301,7 +1301,7 @@
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
- result_type operator()(const argument_type& __opt) const _NOEXCEPT
+ result_type operator()(const argument_type& __opt) const
{
return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
}
diff --git a/include/thread b/include/thread
index 94c77e0..874ce3e 100644
--- a/include/thread
+++ b/include/thread
@@ -261,7 +261,7 @@
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(__thread_id __v) const
+ size_t operator()(__thread_id __v) const _NOEXCEPT
{
return hash<__libcpp_thread_id>()(__v.__id_);
}
diff --git a/include/variant b/include/variant
index 099e6c3..33f88e0 100644
--- a/include/variant
+++ b/include/variant
@@ -1562,7 +1562,7 @@
using result_type = size_t;
inline _LIBCPP_INLINE_VISIBILITY
- result_type operator()(const argument_type&) const {
+ result_type operator()(const argument_type&) const _NOEXCEPT {
return 66740831; // return a fundamentally attractive random value.
}
};