diff options
Diffstat (limited to 'test/std/utilities/function.objects/unord.hash/pointer.pass.cpp')
-rw-r--r-- | test/std/utilities/function.objects/unord.hash/pointer.pass.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp index a48394495e2d..36280a38e0a7 100644 --- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp @@ -23,6 +23,8 @@ #include <type_traits> #include <limits> +#include "test_macros.h" + template <class T> void test() @@ -30,6 +32,7 @@ test() typedef std::hash<T> H; static_assert((std::is_same<typename H::argument_type, T>::value), "" ); static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; typedef typename std::remove_pointer<T>::type type; @@ -38,7 +41,20 @@ test() assert(h(&i) != h(&j)); } +// can't hash nullptr_t until c++17 +void test_nullptr() +{ +#if TEST_STD_VER > 14 + typedef std::nullptr_t T; + typedef std::hash<T> H; + static_assert((std::is_same<typename H::argument_type, T>::value), "" ); + static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" ); + ASSERT_NOEXCEPT(H()(T())); +#endif +} + int main() { test<int*>(); + test_nullptr(); } |