diff --git a/include/functional b/include/functional index 2a810b1a0..977ada67f 100644 --- a/include/functional +++ b/include/functional @@ -470,6 +470,7 @@ template <> struct hash; template <> struct hash; template struct hash; +template <> struct hash; // C++17 } // std 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 d71514b52..36280a38e 100644 --- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp @@ -41,13 +41,16 @@ 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 H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); ASSERT_NOEXCEPT(H()(T())); +#endif } int main() diff --git a/test/support/test_macros.h b/test/support/test_macros.h index 1db3f7f8f..3cde8cc6c 100644 --- a/test/support/test_macros.h +++ b/test/support/test_macros.h @@ -150,11 +150,16 @@ #define TEST_NORETURN [[noreturn]] #endif +#if TEST_STD_VER < 11 +#define ASSERT_NOEXCEPT(...) +#define ASSERT_NOT_NOEXCEPT(...) +#else #define ASSERT_NOEXCEPT(...) \ static_assert(noexcept(__VA_ARGS__), "Operation must be noexcept") #define ASSERT_NOT_NOEXCEPT(...) \ static_assert(!noexcept(__VA_ARGS__), "Operation must NOT be noexcept") +#endif /* Macros for testing libc++ specific behavior and extensions */ #if defined(_LIBCPP_VERSION)