mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-21 23:30:38 +08:00
Mark P0771 as complete; we already did this - I just added tests to be sure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347343 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
// class function<R(ArgTypes...)>
|
||||
|
||||
// function(const function& f);
|
||||
// function(function&& f);
|
||||
// function(function&& f); // noexcept in C++20
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -109,6 +109,10 @@ int main()
|
||||
assert(globalMemCounter.checkOutstandingNewEq(1));
|
||||
assert(f.target<A>());
|
||||
assert(f.target<int(*)(int)>() == 0);
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#endif
|
||||
std::function<int(int)> f2 = std::move(f);
|
||||
assert(A::count == 1);
|
||||
assert(globalMemCounter.checkOutstandingNewEq(1));
|
||||
@@ -129,6 +133,10 @@ int main()
|
||||
assert(A::count == 1);
|
||||
assert(f.target<A>() == nullptr);
|
||||
assert(f.target<Ref>());
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#endif
|
||||
std::function<int(int)> f2(std::move(f));
|
||||
assert(A::count == 1);
|
||||
assert(f2.target<A>() == nullptr);
|
||||
@@ -144,6 +152,10 @@ int main()
|
||||
std::function<int(int)> f(p);
|
||||
assert(f.target<A>() == nullptr);
|
||||
assert(f.target<Ptr>());
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#endif
|
||||
std::function<int(int)> f2(std::move(f));
|
||||
assert(f2.target<A>() == nullptr);
|
||||
assert(f2.target<Ptr>());
|
||||
|
Reference in New Issue
Block a user