Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx17Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"`P0508R0 <https://wg21.link/P0508R0>`__","Wording for GB 58 - structured bindings for node_handles","2016-11 (Issaquah)","|Complete|","7","`#99944 <https://github.com/llvm/llvm-project/issues/99944>`__",""
"`P0509R1 <https://wg21.link/P0509R1>`__","Updating ""Restrictions on exception handling""","2016-11 (Issaquah)","|Nothing To Do|","n/a","`#103676 <https://github.com/llvm/llvm-project/issues/103676>`__",""
"`P0510R0 <https://wg21.link/P0510R0>`__","Disallowing references, incomplete types, arrays, and empty variants","2016-11 (Issaquah)","|Complete|","4","`#103677 <https://github.com/llvm/llvm-project/issues/103677>`__",""
"`P0513R0 <https://wg21.link/P0513R0>`__","Poisoning the Hash","2016-11 (Issaquah)","|Complete|","5","`#103678 <https://github.com/llvm/llvm-project/issues/103678>`__",""
"`P0513R0 <https://wg21.link/P0513R0>`__","Poisoning the Hash","2016-11 (Issaquah)","|Complete|","5","`#103678 <https://github.com/llvm/llvm-project/issues/103678>`__","Implemented as a DR against C++11 since LLVM 22. MSVC STL does the same."
"`P0516R0 <https://wg21.link/P0516R0>`__","Clarify That shared_future's Copy Operations have Wide Contracts","2016-11 (Issaquah)","|Complete|","4","`#103679 <https://github.com/llvm/llvm-project/issues/103679>`__",""
"`P0517R0 <https://wg21.link/P0517R0>`__","Make future_error Constructible","2016-11 (Issaquah)","|Complete|","4","`#103680 <https://github.com/llvm/llvm-project/issues/103680>`__",""
"`P0521R0 <https://wg21.link/P0521R0>`__","Proposed Resolution for CA 14 (shared_ptr use_count/unique)","2016-11 (Issaquah)","|Complete|","18","`#103681 <https://github.com/llvm/llvm-project/issues/103681>`__",""
Expand Down
9 changes: 0 additions & 9 deletions libcxx/include/__functional/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,10 @@ struct __hash_impl<long double> : __scalar_hash<long double> {
template <class _Tp>
struct hash : public __hash_impl<_Tp> {};

#if _LIBCPP_STD_VER >= 17

template <>
struct hash<nullptr_t> : public __unary_function<nullptr_t, size_t> {
_LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
};
#endif

#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Hash>
Expand All @@ -452,18 +449,12 @@ template <class _Key, class _Hash = hash<_Key> >
using __has_enabled_hash _LIBCPP_NODEBUG =
integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >;

# if _LIBCPP_STD_VER >= 17
template <class _Type, class>
using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;

template <class _Type, class... _Keys>
using __enable_hash_helper _LIBCPP_NODEBUG =
__enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >;
# else
template <class _Type, class...>
using __enable_hash_helper _LIBCPP_NODEBUG = _Type;
# endif

#endif // !_LIBCPP_CXX03_LANG

_LIBCPP_END_NAMESPACE_STD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// size_t operator()(T val) const;
// };

// XFAIL: FROZEN-CXX03-HEADERS-FIXME

// Not very portable

#include <cassert>
Expand Down Expand Up @@ -44,18 +46,14 @@ 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;
void test_nullptr() {
typedef std::nullptr_t T;
typedef std::hash<T> H;
#if TEST_STD_VER <= 17
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
#endif
ASSERT_NOEXCEPT(H()(T()));
static_assert((std::is_same<typename H::argument_type, T>::value), "");
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "");
#endif
ASSERT_NOEXCEPT(H()(T()));
}

int main(int, char**)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ int main(int, char**)
test_enabled_with_deleter<A, PointerDeleter<A, 1>>();
test_enabled_with_deleter<A[], PointerDeleter<A[], 1>>();

#if TEST_STD_VER > 14
test_disabled_with_deleter<int, PointerDeleter<int, 0>>();
test_disabled_with_deleter<int[], PointerDeleter<int[], 0>>();
test_disabled_with_deleter<A, PointerDeleter<A, 0>>();
test_disabled_with_deleter<A[], PointerDeleter<A[], 0>>();
#endif
}
#endif

Expand Down
10 changes: 3 additions & 7 deletions libcxx/test/support/poisoned_hash_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,9 @@ struct Class {};
// Each header that declares the std::hash template provides enabled
// specializations of std::hash for std::nullptr_t and all cv-unqualified
// arithmetic, enumeration, and pointer types.
#if TEST_STD_VER >= 17
using MaybeNullptr = types::type_list<std::nullptr_t>;
#else
using MaybeNullptr = types::type_list<>;
#endif
using LibraryHashTypes = types::
concatenate_t<types::arithmetic_types, types::type_list<Enum, EnumClass, void*, void const*, Class*>, MaybeNullptr>;
using LibraryHashTypes =
types::concatenate_t<types::arithmetic_types,
types::type_list<Enum, EnumClass, void*, void const*, Class*, std::nullptr_t>>;

struct TestHashEnabled {
template <class T>
Expand Down
Loading