From 3f3abaf40ad5c732277e0d0be3c0e86b8ba49f34 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Tue, 15 Feb 2022 16:38:34 -0500 Subject: [PATCH] [libc++] LWG2148, LWG2543: Enable std::hash in C++03 and C++11. Fixes #49601. Differential Revision: https://reviews.llvm.org/D119891 --- libcxx/include/__functional/hash.h | 5 +---- .../std/utilities/function.objects/unord.hash/enum.pass.cpp | 5 +---- .../utilities/function.objects/unord.hash/non_enum.pass.cpp | 2 +- libcxx/test/support/poisoned_hash_helper.h | 4 ---- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h index 61b87617db8ff..2b3b96e534216 100644 --- a/libcxx/include/__functional/hash.h +++ b/libcxx/include/__functional/hash.h @@ -781,8 +781,6 @@ struct _LIBCPP_TEMPLATE_VIS hash } }; -#if _LIBCPP_STD_VER > 11 - _LIBCPP_SUPPRESS_DEPRECATED_PUSH template ::value> struct _LIBCPP_TEMPLATE_VIS __enum_hash @@ -799,7 +797,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP size_t operator()(_Tp __v) const _NOEXCEPT { typedef typename underlying_type<_Tp>::type type; - return hash{}(static_cast(__v)); + return hash()(static_cast(__v)); } }; template @@ -813,7 +811,6 @@ template struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> { }; -#endif #if _LIBCPP_STD_VER > 14 diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp index 4aece56b72117..6dd14dc77496a 100644 --- a/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp @@ -8,12 +8,9 @@ // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -// UNSUPPORTED: c++03, c++11 - // -// make sure that we can hash enumeration values -// Not very portable +// Make sure that we can hash enumeration values. #include "test_macros.h" diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp index 85fed02190661..94cc9d912f3a7 100644 --- a/libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: c++03 // diff --git a/libcxx/test/support/poisoned_hash_helper.h b/libcxx/test/support/poisoned_hash_helper.h index 9df349656da96..a0271e4af1e44 100644 --- a/libcxx/test/support/poisoned_hash_helper.h +++ b/libcxx/test/support/poisoned_hash_helper.h @@ -79,12 +79,8 @@ using LibraryHashTypes = TypeList< float, double, long double, -#if TEST_STD_VER >= 14 - // Enum types PoisonedHashDetail::Enum, PoisonedHashDetail::EnumClass, -#endif - // pointer types void*, void const*, PoisonedHashDetail::Class*