summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/function.objects/func.not_fn
diff options
context:
space:
mode:
authorStephan T. Lavavej <stl@exchange.microsoft.com>2018-01-10 00:39:46 +0000
committerStephan T. Lavavej <stl@exchange.microsoft.com>2018-01-10 00:39:46 +0000
commit04576cc060bf33c7503ba7cb3d4182b79bcc2c46 (patch)
tree6d4f7994006101c96bca37f1dbae882f1cb92fc7 /libcxx/test/std/utilities/function.objects/func.not_fn
parent88e9a15b802e141232e962836828470b4ae402d6 (diff)
downloadbcm5719-llvm-04576cc060bf33c7503ba7cb3d4182b79bcc2c46.tar.gz
bcm5719-llvm-04576cc060bf33c7503ba7cb3d4182b79bcc2c46.zip
[libcxx] [test] Improve MSVC portability.
test/support/msvc_stdlib_force_include.hpp When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros. When testing MSVC's STL, simulate a few library feature-test macros. test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp The vector_size attribute is a non-Standard extension that's supported by Clang and GCC, but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`. Additionally, while these tests pass when MSVC's STL is compiled with Clang, I don't consider this to be a supported scenario for our library, so also guard this with defined(_LIBCPP_VERSION). test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;` and `call_wrapper(const call_wrapper&) = default;`. According to 15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable. Therefore, guard the assignability tests as libc++ specific. Add a (void) cast to tolerate not_fn() being marked as nodiscard. Fixes D41213. llvm-svn: 322144
Diffstat (limited to 'libcxx/test/std/utilities/function.objects/func.not_fn')
-rw-r--r--libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
index 7601ff9d147..f33b4157721 100644
--- a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -305,15 +305,17 @@ void constructor_tests()
using RetT = decltype(std::not_fn(value));
static_assert(std::is_move_constructible<RetT>::value, "");
static_assert(std::is_copy_constructible<RetT>::value, "");
- static_assert(std::is_move_assignable<RetT>::value, "");
- static_assert(std::is_copy_assignable<RetT>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_move_assignable<RetT>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_copy_assignable<RetT>::value, "");
auto ret = std::not_fn(value);
assert(ret() == false);
auto ret2 = std::not_fn(value2);
assert(ret2() == true);
+#if defined(_LIBCPP_VERSION)
ret = ret2;
assert(ret() == true);
assert(ret2() == true);
+#endif // _LIBCPP_VERSION
}
{
using T = MoveAssignableWrapper;
@@ -322,14 +324,16 @@ void constructor_tests()
using RetT = decltype(std::not_fn(std::move(value)));
static_assert(std::is_move_constructible<RetT>::value, "");
static_assert(!std::is_copy_constructible<RetT>::value, "");
- static_assert(std::is_move_assignable<RetT>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_move_assignable<RetT>::value, "");
static_assert(!std::is_copy_assignable<RetT>::value, "");
auto ret = std::not_fn(std::move(value));
assert(ret() == false);
auto ret2 = std::not_fn(std::move(value2));
assert(ret2() == true);
+#if defined(_LIBCPP_VERSION)
ret = std::move(ret2);
assert(ret() == true);
+#endif // _LIBCPP_VERSION
}
}
@@ -426,7 +430,7 @@ void throws_in_constructor_test()
{
ThrowsOnCopy cp;
try {
- std::not_fn(cp);
+ (void)std::not_fn(cp);
assert(false);
} catch (int const& value) {
assert(value == 42);
OpenPOWER on IntegriCloud