[libcxx-commits] [PATCH] D119891: [libc++] LWG2148, LWG2543: Enable std::hash<Enum> in C++03 and C++11
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 16 08:02:25 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3f3abaf40ad5: [libc++] LWG2148, LWG2543: Enable std::hash<Enum> in C++03 and C++11. (authored by arthur.j.odwyer).
Changed prior to commit:
https://reviews.llvm.org/D119891?vs=409050&id=409269#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119891/new/
https://reviews.llvm.org/D119891
Files:
libcxx/include/__functional/hash.h
libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
libcxx/test/support/poisoned_hash_helper.h
Index: libcxx/test/support/poisoned_hash_helper.h
===================================================================
--- libcxx/test/support/poisoned_hash_helper.h
+++ libcxx/test/support/poisoned_hash_helper.h
@@ -79,12 +79,8 @@
float,
double,
long double,
-#if TEST_STD_VER >= 14
- // Enum types
PoisonedHashDetail::Enum,
PoisonedHashDetail::EnumClass,
-#endif
- // pointer types
void*,
void const*,
PoisonedHashDetail::Class*
Index: libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
===================================================================
--- libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
+++ libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03, c++11
+// UNSUPPORTED: c++03
// <functional>
Index: libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
===================================================================
--- libcxx/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
+++ 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
-
// <functional>
-// make sure that we can hash enumeration values
-// Not very portable
+// Make sure that we can hash enumeration values.
#include "test_macros.h"
Index: libcxx/include/__functional/hash.h
===================================================================
--- libcxx/include/__functional/hash.h
+++ libcxx/include/__functional/hash.h
@@ -781,8 +781,6 @@
}
};
-#if _LIBCPP_STD_VER > 11
-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Tp, bool = is_enum<_Tp>::value>
struct _LIBCPP_TEMPLATE_VIS __enum_hash
@@ -799,7 +797,7 @@
size_t operator()(_Tp __v) const _NOEXCEPT
{
typedef typename underlying_type<_Tp>::type type;
- return hash<type>{}(static_cast<type>(__v));
+ return hash<type>()(static_cast<type>(__v));
}
};
template <class _Tp>
@@ -813,7 +811,6 @@
struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
{
};
-#endif
#if _LIBCPP_STD_VER > 14
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119891.409269.patch
Type: text/x-patch
Size: 2328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220216/11e36081/attachment.bin>
More information about the libcxx-commits
mailing list