Fix recent build errors

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292689 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-01-21 00:57:29 +00:00
parent 952eaecfc6
commit 17b6e14cdc
3 changed files with 8 additions and 3 deletions

View File

@@ -46,13 +46,16 @@ void test_disabled_with_deleter() {
test_hash_disabled_for_type<pointer>(); test_hash_disabled_for_type<pointer>();
} }
namespace std {
template <class T> template <class T>
struct std::hash<min_pointer<T, std::integral_constant<size_t, 1>>> { struct hash<::min_pointer<T, std::integral_constant<size_t, 1>>> {
size_t operator()(min_pointer<T, std::integral_constant<size_t, 1>> p) const { size_t operator()(::min_pointer<T, std::integral_constant<size_t, 1>> p) const {
if (!p) return 0; if (!p) return 0;
return std::hash<T*>{}(std::addressof(*p)); return std::hash<T*>{}(std::addressof(*p));
} }
}; };
}
struct A {}; struct A {};

View File

@@ -30,7 +30,9 @@ int main()
static_assert((std::is_same<typename H::argument_type, std::type_index>::value), "" ); static_assert((std::is_same<typename H::argument_type, std::type_index>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" ); static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
} }
#if TEST_STD_VER >= 11
{ {
test_hash_enabled_for_type<std::type_index>(std::type_index(typeid(int))); test_hash_enabled_for_type<std::type_index>(std::type_index(typeid(int)));
} }
#endif
} }

View File

@@ -163,7 +163,7 @@ void test_hash_enabled(InputKey const& key) {
static_assert(can_hash<Hash(ConvertibleTo<Key> &&)>(), ""); static_assert(can_hash<Hash(ConvertibleTo<Key> &&)>(), "");
static_assert(can_hash<Hash(ConvertibleTo<Key> const&&)>(), ""); static_assert(can_hash<Hash(ConvertibleTo<Key> const&&)>(), "");
const Hash h; const Hash h{};
assert(h(key) == h(key)); assert(h(key) == h(key));
} }