[libcxx] r287382 - [libcxx] [test] D26815: Fix an assumption about the state of moved-from std::functions.
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 18 13:54:38 PST 2016
Author: stl_msft
Date: Fri Nov 18 15:54:38 2016
New Revision: 287382
URL: http://llvm.org/viewvc/llvm-project?rev=287382&view=rev
Log:
[libcxx] [test] D26815: Fix an assumption about the state of moved-from std::functions.
The Standard doesn't provide any guarantees beyond "valid but unspecified" for
moved-from std::functions. libcxx moves from small targets and leaves them
there, while MSVC's STL empties out the source. Mark these assertions as
libcxx-specific.
Modified:
libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
Modified: libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp?rev=287382&r1=287381&r2=287382&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp Fri Nov 18 15:54:38 2016
@@ -132,7 +132,7 @@ int main()
assert(A::count == 1);
assert(f2.target<A>() == nullptr);
assert(f2.target<Ref>());
- assert(f.target<Ref>()); // f is unchanged because the target is small
+ LIBCPP_ASSERT(f.target<Ref>()); // f is unchanged because the target is small
}
{
// Test that moving a function constructed from a function pointer
@@ -146,7 +146,7 @@ int main()
std::function<int(int)> f2(std::move(f));
assert(f2.target<A>() == nullptr);
assert(f2.target<Ptr>());
- assert(f.target<Ptr>()); // f is unchanged because the target is small
+ LIBCPP_ASSERT(f.target<Ptr>()); // f is unchanged because the target is small
}
#endif // TEST_STD_VER >= 11
}
More information about the cfe-commits
mailing list