[libcxx] r225403 - libc++ implements its' hash objects as deriving from std::unary_function, and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library.
Marshall Clow
mclow.lists at gmail.com
Wed Jan 7 13:53:23 PST 2015
Author: marshall
Date: Wed Jan 7 15:53:23 2015
New Revision: 225403
URL: http://llvm.org/viewvc/llvm-project?rev=225403&view=rev
Log:
libc++ implements its' hash objects as deriving from std::unary_function, and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library.
Modified:
libcxx/trunk/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
libcxx/trunk/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp
libcxx/trunk/test/std/strings/basic.string.hash/strings.pass.cpp
libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
libcxx/trunk/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp Wed Jan 7 15:53:23 2015
@@ -29,8 +29,9 @@ int main()
{
typedef std::vector<bool> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+
bool ba[] = {true, false, true, true, false};
T vb(std::begin(ba), std::end(ba));
H h;
Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp (original)
+++ libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp Wed Jan 7 15:53:23 2015
@@ -27,8 +27,8 @@ test(int i)
{
typedef std::error_code T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
H h;
T ec(i, std::system_category());
assert(h(ec) == i);
Modified: libcxx/trunk/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/string.view/string.view.hash/string_view.pass.cpp Wed Jan 7 15:53:23 2015
@@ -29,8 +29,8 @@ void
test()
{
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
// std::string g1 = "1234567890";
// std::string g2 = "1234567891";
Modified: libcxx/trunk/test/std/strings/basic.string.hash/strings.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string.hash/strings.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string.hash/strings.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string.hash/strings.pass.cpp Wed Jan 7 15:53:23 2015
@@ -27,8 +27,8 @@ void
test()
{
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
std::string g1 = "1234567890";
std::string g2 = "1234567891";
Modified: libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp Wed Jan 7 15:53:23 2015
@@ -28,6 +28,8 @@ int main()
std::thread::id id1;
std::thread::id id2 = std::this_thread::get_id();
typedef std::hash<std::thread::id> H;
+ static_assert((std::is_same<typename H::argument_type, std::thread::id>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
assert(h(id1) != h(id2));
}
Modified: libcxx/trunk/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/unord.hash/enum.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/unord.hash/enum.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/unord.hash/enum.pass.cpp Wed Jan 7 15:53:23 2015
@@ -33,11 +33,12 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
+ typedef std::hash<T> H;
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
typedef typename std::underlying_type<T>::type under_type;
- std::hash<T> h1;
+ H h1;
std::hash<under_type> h2;
for (int i = 0; i <= 5; ++i)
{
Modified: libcxx/trunk/test/std/utilities/function.objects/unord.hash/floating.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/unord.hash/floating.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/unord.hash/floating.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/unord.hash/floating.pass.cpp Wed Jan 7 15:53:23 2015
@@ -28,9 +28,11 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+
std::size_t t0 = h(0.);
std::size_t tn0 = h(-0.);
std::size_t tp1 = h(0.1);
Modified: libcxx/trunk/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/unord.hash/integral.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/unord.hash/integral.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/unord.hash/integral.pass.cpp Wed Jan 7 15:53:23 2015
@@ -27,9 +27,11 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+
for (int i = 0; i <= 5; ++i)
{
T t(i);
Modified: libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp Wed Jan 7 15:53:23 2015
@@ -27,9 +27,11 @@ template <class T>
void
test()
{
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- std::hash<T> >::value), "");
- std::hash<T> h;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+
typedef typename std::remove_pointer<T>::type type;
type i;
type j;
Modified: libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp Wed Jan 7 15:53:23 2015
@@ -28,8 +28,8 @@ test()
{
typedef std::bitset<N> T;
typedef std::hash<T> H;
- static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
- H>::value), "");
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
H h;
T bs(static_cast<unsigned long long>(N));
assert(h(bs) == N);
Modified: libcxx/trunk/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp?rev=225403&r1=225402&r2=225403&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/type.index/type.index.synopsis/hash_type_index.pass.cpp Wed Jan 7 15:53:23 2015
@@ -20,6 +20,7 @@
int main()
{
- static_assert((std::is_base_of<std::unary_function<std::type_index, std::size_t>,
- std::hash<std::type_index> >::value), "");
+ typedef std::hash<std::type_index> H;
+ 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), "" );
}
More information about the cfe-commits
mailing list