diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2015-01-07 21:51:30 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2015-01-07 21:51:30 +0000 |
commit | 601fa8d824de4cc2cbc42c422b25fbdfe3b7dd32 (patch) | |
tree | bb0d04a883c0f7b2f3c6275ac82a48ba134e1ed6 /libcxx/test/std/utilities | |
parent | 136ea3f97b64f82666cb6c8803321e7160af16c7 (diff) | |
download | bcm5719-llvm-601fa8d824de4cc2cbc42c422b25fbdfe3b7dd32.tar.gz bcm5719-llvm-601fa8d824de4cc2cbc42c422b25fbdfe3b7dd32.zip |
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
Diffstat (limited to 'libcxx/test/std/utilities')
4 files changed, 8 insertions, 4 deletions
diff --git a/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp b/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp index 3ffb7051bfd..0adac659123 100644 --- a/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp @@ -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; diff --git a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp index 82efcbc29fa..48800a366a8 100644 --- a/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/bitwise.operations/bit_not.pass.cpp @@ -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); diff --git a/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp b/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp index 12b3543c5c6..8484625a727 100644 --- a/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp @@ -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 diff --git a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp index 2aa4f0ab448..e2498a3b52e 100644 --- a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp @@ -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)); } |