Fix hash requirements check in __hash_table.
r296565 attempted to add better diagnostics when an unordered container
is instantiated with a hash that doesn't meet the Hash requirements.
However I mistakenly checked the wrong set of requirements. Specifically
it checked if the hash met the requirements for specializations of
std::hash. However these requirements are stricter than the generic
Hash requirements.
This patch fixes the assertions to only check the Hash requirements.
llvm-svn: 296919
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: bd6a2d850565341ff6fbf134998d48ad84d35585
diff --git a/include/utility b/include/utility
index 3452fe1..1f41c07 100644
--- a/include/utility
+++ b/include/utility
@@ -1560,14 +1560,19 @@
#endif
#ifndef _LIBCPP_CXX03_LANG
-template <class _Key, class _Hash = std::hash<_Key> >
-using __has_enabled_hash = integral_constant<bool,
- is_default_constructible<_Hash>::value &&
+template <class _Key, class _Hash>
+using __check_hash_requirements = integral_constant<bool,
is_copy_constructible<_Hash>::value &&
is_move_constructible<_Hash>::value &&
__invokable_r<size_t, _Hash, _Key const&>::value
>;
+template <class _Key, class _Hash = std::hash<_Key> >
+using __has_enabled_hash = integral_constant<bool,
+ __check_hash_requirements<_Key, _Hash>::value &&
+ is_default_constructible<_Hash>::value
+>;
+
#if _LIBCPP_STD_VER > 14
template <class _Type, class>
using __enable_hash_helper_imp = _Type;