forked from OSchip/llvm-project
In C++03, a bunch of the arithmetic/logical/comparison functors (such as negate/bit_not.pass/logical_not) were defined as deriving from unary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion.
llvm-svn: 225402
This commit is contained in:
parent
136ea3f97b
commit
601fa8d824
|
@ -19,7 +19,8 @@ int main()
|
|||
{
|
||||
typedef std::negate<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, int>::value), "" );
|
||||
assert(f(36) == -36);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::negate<> F2;
|
||||
|
|
|
@ -20,7 +20,8 @@ int main()
|
|||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::bit_not<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, int>::value), "" );
|
||||
assert((f(0xEA95) & 0xFFFF ) == 0x156A);
|
||||
assert((f(0x58D3) & 0xFFFF ) == 0xA72C);
|
||||
assert((f(0) & 0xFFFF ) == 0xFFFF);
|
||||
|
|
|
@ -19,7 +19,8 @@ int main()
|
|||
{
|
||||
typedef std::logical_not<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, bool>::value), "" );
|
||||
assert(!f(36));
|
||||
assert(f(0));
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
|
|
@ -19,7 +19,8 @@ int main()
|
|||
{
|
||||
typedef std::unary_negate<std::logical_not<int> > F;
|
||||
const F f = F(std::logical_not<int>());
|
||||
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, bool>::value), "" );
|
||||
assert(f(36));
|
||||
assert(!f(0));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue