[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
Tue Feb 15 14:01:23 PST 2022
Quuxplusone updated this revision to Diff 409050.
Quuxplusone edited the summary of this revision.
Quuxplusone added a comment.
On second thought, don't `git rm enum.compile.fail.cpp` — it's the only test coverage we get for the "non-enabled" case in C++03 mode, because `non_enum.pass.cpp` isn't C++03-friendly.
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,8 +8,6 @@
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
-// UNSUPPORTED: c++03, c++11
-
// <functional>
// make sure that we can hash enumeration values
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.409050.patch
Type: text/x-patch
Size: 2224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220215/2b8b5f0a/attachment.bin>
More information about the libcxx-commits
mailing list