summaryrefslogtreecommitdiffstats
path: root/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-05-25 22:36:09 -0700
committerDan Albert <danalbert@google.com>2016-05-25 22:36:09 -0700
commit1d4a1edbc7e4461b59239e1b8297e9dd395a6322 (patch)
treecbe3ea215f179ead1a25b156590da0538a1e7fd7 /test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
parentc004fd909c006eec55077c52ee119e1fa338c9e9 (diff)
downloadexternal_libcxx-1d4a1edbc7e4461b59239e1b8297e9dd395a6322.tar.gz
external_libcxx-1d4a1edbc7e4461b59239e1b8297e9dd395a6322.tar.bz2
external_libcxx-1d4a1edbc7e4461b59239e1b8297e9dd395a6322.zip
Revert "Update aosp/master libcxx rebase to r263688"
The world is burning. This reverts commit c004fd909c006eec55077c52ee119e1fa338c9e9, reversing changes made to 1418e4163da4bb0b9e3fe496e51c23a0dce399d9.
Diffstat (limited to 'test/std/thread/futures/futures.promise/copy_ctor.fail.cpp')
-rw-r--r--test/std/thread/futures/futures.promise/copy_ctor.fail.cpp78
1 files changed, 54 insertions, 24 deletions
diff --git a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
index 779fc5bfc..36a3555ae 100644
--- a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
@@ -6,8 +6,6 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-// UNSUPPORTED: libcpp-has-no-threads
// <future>
@@ -16,36 +14,68 @@
// promise(const promise&) = delete;
#include <future>
+#include <cassert>
-#include "test_macros.h"
+#include "../test_allocator.h"
int main()
{
-#if TEST_STD_VER >= 11
- {
- std::promise<int> p0;
- std::promise<int> p(p0); // expected-error {{call to deleted constructor of 'std::promise<int>'}}
- }
- {
- std::promise<int &> p0;
- std::promise<int &> p(p0); // expected-error {{call to deleted constructor of 'std::promise<int &>'}}
- }
- {
- std::promise<void> p0;
- std::promise<void> p(p0); // expected-error {{call to deleted constructor of 'std::promise<void>'}}
- }
-#else
+ assert(test_alloc_base::count == 0);
{
- std::promise<int> p0;
- std::promise<int> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<int>'}}
+ std::promise<int> p0(std::allocator_arg, test_allocator<int>());
+ std::promise<int> p(p0);
+ assert(test_alloc_base::count == 1);
+ std::future<int> f = p.get_future();
+ assert(test_alloc_base::count == 1);
+ assert(f.valid());
+ try
+ {
+ f = p0.get_future();
+ assert(false);
+ }
+ catch (const std::future_error& e)
+ {
+ assert(e.code() == make_error_code(std::future_errc::no_state));
+ }
+ assert(test_alloc_base::count == 1);
}
+ assert(test_alloc_base::count == 0);
{
- std::promise<int &> p0;
- std::promise<int &> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<int &>'}}
+ std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
+ std::promise<int&> p(p0);
+ assert(test_alloc_base::count == 1);
+ std::future<int&> f = p.get_future();
+ assert(test_alloc_base::count == 1);
+ assert(f.valid());
+ try
+ {
+ f = p0.get_future();
+ assert(false);
+ }
+ catch (const std::future_error& e)
+ {
+ assert(e.code() == make_error_code(std::future_errc::no_state));
+ }
+ assert(test_alloc_base::count == 1);
}
+ assert(test_alloc_base::count == 0);
{
- std::promise<void> p0;
- std::promise<void> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<void>'}}
+ std::promise<void> p0(std::allocator_arg, test_allocator<void>());
+ std::promise<void> p(p0);
+ assert(test_alloc_base::count == 1);
+ std::future<void> f = p.get_future();
+ assert(test_alloc_base::count == 1);
+ assert(f.valid());
+ try
+ {
+ f = p0.get_future();
+ assert(false);
+ }
+ catch (const std::future_error& e)
+ {
+ assert(e.code() == make_error_code(std::future_errc::no_state));
+ }
+ assert(test_alloc_base::count == 1);
}
-#endif
+ assert(test_alloc_base::count == 0);
}