Index: include/optional =================================================================== --- include/optional +++ 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(__opt) ? hash>()(*__opt) : 0; } Index: include/thread =================================================================== --- include/thread +++ 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_); } Index: include/variant =================================================================== --- include/variant +++ 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. } }; Index: test/std/containers/sequences/vector.bool/vector_bool.pass.cpp =================================================================== --- test/std/containers/sequences/vector.bool/vector_bool.pass.cpp +++ test/std/containers/sequences/vector.bool/vector_bool.pass.cpp @@ -31,7 +31,8 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - + ASSERT_NOEXCEPT(H()(T())); + bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); H h; @@ -43,6 +44,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); H h; Index: test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp =================================================================== --- test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp +++ test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp @@ -29,6 +29,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); const std::size_t result = h(ec); Index: test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp =================================================================== --- test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp +++ test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp @@ -29,6 +29,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); const std::size_t result = h(ec); Index: test/std/strings/basic.string.hash/strings.pass.cpp =================================================================== --- test/std/strings/basic.string.hash/strings.pass.cpp +++ test/std/strings/basic.string.hash/strings.pass.cpp @@ -22,6 +22,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -29,6 +31,8 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); + H h; std::string g1 = "1234567890"; std::string g2 = "1234567891"; Index: test/std/strings/string.view/string.view.hash/string_view.pass.cpp =================================================================== --- test/std/strings/string.view/string.view.hash/string_view.pass.cpp +++ test/std/strings/string.view/string.view.hash/string_view.pass.cpp @@ -23,6 +23,8 @@ #include #include +#include "test_macros.h" + using std::string_view; template @@ -36,6 +38,7 @@ typedef typename SV::value_type char_type; typedef std::basic_string String; typedef std::hash SH; + ASSERT_NOEXCEPT(H()(SV())); char_type g1 [ 10 ]; char_type g2 [ 10 ]; Index: test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp =================================================================== --- test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp +++ test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp @@ -30,6 +30,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(id2)); H h; assert(h(id1) != h(id2)); } Index: test/std/utilities/function.objects/unord.hash/enum.pass.cpp =================================================================== --- test/std/utilities/function.objects/unord.hash/enum.pass.cpp +++ test/std/utilities/function.objects/unord.hash/enum.pass.cpp @@ -36,6 +36,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); typedef typename std::underlying_type::type under_type; H h1; Index: test/std/utilities/function.objects/unord.hash/floating.pass.cpp =================================================================== --- test/std/utilities/function.objects/unord.hash/floating.pass.cpp +++ test/std/utilities/function.objects/unord.hash/floating.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -31,6 +33,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; std::size_t t0 = h(0.); Index: test/std/utilities/function.objects/unord.hash/integral.pass.cpp =================================================================== --- test/std/utilities/function.objects/unord.hash/integral.pass.cpp +++ test/std/utilities/function.objects/unord.hash/integral.pass.cpp @@ -31,6 +31,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; for (int i = 0; i <= 5; ++i) @@ -64,42 +65,42 @@ test(); test(); -// LWG #2119 +// LWG #2119 test(); test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); test(); test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); test(); test(); Index: test/std/utilities/function.objects/unord.hash/pointer.pass.cpp =================================================================== --- test/std/utilities/function.objects/unord.hash/pointer.pass.cpp +++ test/std/utilities/function.objects/unord.hash/pointer.pass.cpp @@ -23,6 +23,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -30,6 +32,7 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; typedef typename std::remove_pointer::type type; @@ -38,7 +41,17 @@ assert(h(&i) != h(&j)); } +void test_nullptr() +{ + typedef std::nullptr_t T; + typedef std::hash H; + static_assert((std::is_same::value), "" ); + static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); +} + int main() { test(); + test_nullptr(); } Index: test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp =================================================================== --- test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp +++ test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp @@ -30,6 +30,8 @@ typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); + H h; T bs(static_cast(N)); const std::size_t result = h(bs); Index: test/std/utilities/variant/variant.hash/hash.pass.cpp =================================================================== --- test/std/utilities/variant/variant.hash/hash.pass.cpp +++ test/std/utilities/variant/variant.hash/hash.pass.cpp @@ -102,6 +102,7 @@ assert(h(m1) == h(m2)); { ASSERT_SAME_TYPE(decltype(h(m1)), std::size_t); + ASSERT_NOEXCEPT(h(m1)); static_assert(std::is_copy_constructible::value, ""); } {