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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225403 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user