aboutsummaryrefslogtreecommitdiff
path: root/test/std/thread/futures
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:54:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:54:09 +0000
commitb4c64ad90b81d2a779786b7edb4c5c6dd28cc57d (patch)
tree13f237c02db4d1894ab06884d1b739344766bede /test/std/thread/futures
parent61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (diff)
Notes
Diffstat (limited to 'test/std/thread/futures')
-rw-r--r--test/std/thread/futures/futures.async/async.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.async/async_race.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp29
-rw-r--r--test/std/thread/futures/futures.promise/copy_assign.fail.cpp82
-rw-r--r--test/std/thread/futures/futures.promise/copy_ctor.fail.cpp76
-rw-r--r--test/std/thread/futures/futures.promise/default.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/dtor.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/get_future.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/move_assign.pass.cpp38
-rw-r--r--test/std/thread/futures/futures.promise/move_ctor.pass.cpp32
-rw-r--r--test/std/thread/futures/futures.promise/set_exception.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_lvalue.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_rvalue.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_value_const.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_value_void.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/swap.pass.cpp45
-rw-r--r--test/std/thread/futures/futures.promise/uses_allocator.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp3
-rw-r--r--test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/dtor.pass.cpp30
-rw-r--r--test/std/thread/futures/futures.shared_future/get.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.shared_future/move_assign.pass.cpp3
-rw-r--r--test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/wait.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/wait_for.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/wait_until.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp30
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp5
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp7
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp25
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp19
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp8
-rw-r--r--test/std/thread/futures/futures.tas/types.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp59
-rw-r--r--test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp51
-rw-r--r--test/std/thread/futures/futures.unique_future/dtor.pass.cpp30
-rw-r--r--test/std/thread/futures/futures.unique_future/get.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.unique_future/share.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/wait.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/wait_for.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/wait_until.pass.cpp221
-rw-r--r--test/std/thread/futures/test_allocator.h158
-rw-r--r--test/std/thread/futures/version.pass.cpp22
59 files changed, 382 insertions, 645 deletions
diff --git a/test/std/thread/futures/futures.async/async.pass.cpp b/test/std/thread/futures/futures.async/async.pass.cpp
index c8a742566d8f2..2c1313b7a2f0f 100644
--- a/test/std/thread/futures/futures.async/async.pass.cpp
+++ b/test/std/thread/futures/futures.async/async.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.async/async_race.pass.cpp b/test/std/thread/futures/futures.async/async_race.pass.cpp
index 325a027132de9..9acdd1abc4857 100644
--- a/test/std/thread/futures/futures.async/async_race.pass.cpp
+++ b/test/std/thread/futures/futures.async/async_race.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp b/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
index 70a4e00b0d6af..c0fe2ef881e89 100644
--- a/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -19,36 +20,36 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
- std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ std::promise<int> p(std::allocator_arg, test_allocator<int>(42));
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
- std::promise<int&> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ std::promise<int&> p(std::allocator_arg, test_allocator<int>(42));
+ assert(test_alloc_base::alloc_count == 1);
std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
- std::promise<void> p(std::allocator_arg, test_allocator<void>());
- assert(test_alloc_base::count == 1);
+ std::promise<void> p(std::allocator_arg, test_allocator<void>(42));
+ assert(test_alloc_base::alloc_count == 1);
std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
// Test with a minimal allocator
{
std::promise<int> p(std::allocator_arg, bare_allocator<void>());
diff --git a/test/std/thread/futures/futures.promise/copy_assign.fail.cpp b/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
index c08278122225c..e150ba0df65a1 100644
--- a/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
@@ -14,74 +14,36 @@
// promise& operator=(const promise& rhs) = delete;
#include <future>
-#include <cassert>
-#include "../test_allocator.h"
+#include "test_macros.h"
int main()
{
- assert(test_alloc_base::count == 0);
+#if TEST_STD_VER >= 11
{
- std::promise<int> p0(std::allocator_arg, test_allocator<int>());
- std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
- 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);
+ std::promise<int> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
- assert(test_alloc_base::count == 0);
{
- std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
- std::promise<int&> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
- 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);
+ std::promise<int&> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
- assert(test_alloc_base::count == 0);
{
- std::promise<void> p0(std::allocator_arg, test_allocator<void>());
- std::promise<void> p(std::allocator_arg, test_allocator<void>());
- assert(test_alloc_base::count == 2);
- 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);
+ std::promise<void> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
- assert(test_alloc_base::count == 0);
+#else
+ {
+ std::promise<int> p0, p;
+ p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int>'}}
+ }
+ {
+ std::promise<int&> p0, p;
+ p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int &>'}}
+ }
+ {
+ std::promise<void> p0, p;
+ p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<void>'}}
+ }
+#endif
}
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 36a3555aed468..34becbc1259b3 100644
--- a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
@@ -14,68 +14,36 @@
// promise(const promise&) = delete;
#include <future>
-#include <cassert>
-#include "../test_allocator.h"
+#include "test_macros.h"
int main()
{
- assert(test_alloc_base::count == 0);
+#if TEST_STD_VER >= 11
{
- 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);
+ std::promise<int> p0;
+ std::promise<int> p(p0); // expected-error {{call to deleted constructor of 'std::promise<int>'}}
}
- assert(test_alloc_base::count == 0);
{
- 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);
+ std::promise<int &> p0;
+ std::promise<int &> p(p0); // expected-error {{call to deleted constructor of 'std::promise<int &>'}}
}
- assert(test_alloc_base::count == 0);
{
- 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);
+ std::promise<void> p0;
+ std::promise<void> p(p0); // expected-error {{call to deleted constructor of 'std::promise<void>'}}
}
- assert(test_alloc_base::count == 0);
+#else
+ {
+ 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::promise<int &> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<int &>'}}
+ }
+ {
+ std::promise<void> p0;
+ std::promise<void> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<void>'}}
+ }
+#endif
}
diff --git a/test/std/thread/futures/futures.promise/default.pass.cpp b/test/std/thread/futures/futures.promise/default.pass.cpp
index 95c9657c633e5..d108b42756e23 100644
--- a/test/std/thread/futures/futures.promise/default.pass.cpp
+++ b/test/std/thread/futures/futures.promise/default.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/dtor.pass.cpp b/test/std/thread/futures/futures.promise/dtor.pass.cpp
index 78912f12adb98..e3151ab383228 100644
--- a/test/std/thread/futures/futures.promise/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/get_future.pass.cpp b/test/std/thread/futures/futures.promise/get_future.pass.cpp
index a7d084ee78730..bc45e28a9f963 100644
--- a/test/std/thread/futures/futures.promise/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.promise/get_future.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/move_assign.pass.cpp b/test/std/thread/futures/futures.promise/move_assign.pass.cpp
index c3097df74990a..9dd8a9daef806 100644
--- a/test/std/thread/futures/futures.promise/move_assign.pass.cpp
+++ b/test/std/thread/futures/futures.promise/move_assign.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,20 +20,19 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p = std::move(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -42,17 +43,17 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
std::promise<int&> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p = std::move(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -63,17 +64,17 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<void> p0(std::allocator_arg, test_allocator<void>());
std::promise<void> p(std::allocator_arg, test_allocator<void>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p = std::move(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -84,8 +85,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/move_ctor.pass.cpp b/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
index eeec4fb15b956..9a68b5c1b4e19 100644
--- a/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,18 +20,17 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::move(p0));
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -40,15 +41,15 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
std::promise<int&> p(std::move(p0));
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -59,15 +60,15 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<void> p0(std::allocator_arg, test_allocator<void>());
std::promise<void> p(std::move(p0));
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -78,8 +79,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/set_exception.pass.cpp b/test/std/thread/futures/futures.promise/set_exception.pass.cpp
index 51c05eb803cb7..6ef41af945459 100644
--- a/test/std/thread/futures/futures.promise/set_exception.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_exception.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
index 5e57692563d88..f54d7cd16bdb5 100644
--- a/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
index cdc37775012ce..98394871e7039 100644
--- a/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
index 18f87c596a005..e127d2c37fafd 100644
--- a/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
index dab4bf7e9c832..9cce3f59550a2 100644
--- a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
index ec50cc3102983..79137488e606c 100644
--- a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
index 8c092084668dd..6a0ce36326eb9 100644
--- a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_const.pass.cpp b/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
index 6673f63075791..db7465ceab858 100644
--- a/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_void.pass.cpp b/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
index 5012e0bfe5fd7..87be8cd60a5e2 100644
--- a/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/swap.pass.cpp b/test/std/thread/futures/futures.promise/swap.pass.cpp
index 1ed3e646813c3..21c946981a282 100644
--- a/test/std/thread/futures/futures.promise/swap.pass.cpp
+++ b/test/std/thread/futures/futures.promise/swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -20,65 +21,65 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p.swap(p0);
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
swap(p, p0);
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p;
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
p.swap(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p;
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
swap(p, p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp b/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
index 458826e956e12..9a1d41cc0cb61 100644
--- a/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
+++ b/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
@@ -18,7 +18,7 @@
// : true_type { };
#include <future>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
diff --git a/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp b/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
index b23ba196ec30e..3f9e945dddaf7 100644
--- a/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -20,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -72,5 +72,4 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp b/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
index 425d1f9be96ff..1da08808db2e7 100644
--- a/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp b/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
index 3a78b80f0634a..1590efd7b634d 100644
--- a/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/dtor.pass.cpp b/test/std/thread/futures/futures.shared_future/dtor.pass.cpp
index baa89cb12b1c4..af061268410d0 100644
--- a/test/std/thread/futures/futures.shared_future/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,51 +20,51 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int T;
std::shared_future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int& T;
std::shared_future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef void T;
std::shared_future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.shared_future/get.pass.cpp b/test/std/thread/futures/futures.shared_future/get.pass.cpp
index c5ee234b127f8..6eea1d889b6db 100644
--- a/test/std/thread/futures/futures.shared_future/get.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/get.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp b/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
index 6b58f41c90855..3a1ef7a6849cb 100644
--- a/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -20,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -72,5 +72,4 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp b/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
index 32b8fd77c672b..15323d678e3c7 100644
--- a/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/wait.pass.cpp b/test/std/thread/futures/futures.shared_future/wait.pass.cpp
index 4293fcab35643..6ff74f6c6b906 100644
--- a/test/std/thread/futures/futures.shared_future/wait.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp b/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
index e5a4754e38ad5..1ec086266b0d4 100644
--- a/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
index 6a6aeba7759e3..9cdc2e431f450 100644
--- a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+ // UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
index 70ea0ad31feda..6c6418594d007 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -14,35 +16,11 @@
// packaged_task& operator=(packaged_task&) = delete;
#include <future>
-#include <cassert>
-
-class A
-{
- long data_;
-
-public:
- explicit A(long i) : data_(i) {}
-
- long operator()(long i, long j) const {return data_ + i + j;}
-};
int main()
{
{
- std::packaged_task<double(int, char)> p0(A(5));
- std::packaged_task<double(int, char)> p;
- p = p0;
- assert(!p0.valid());
- assert(p.valid());
- std::future<double> f = p.get_future();
- p(3, 'a');
- assert(f.get() == 105.0);
- }
- {
- std::packaged_task<double(int, char)> p0;
- std::packaged_task<double(int, char)> p;
- p = p0;
- assert(!p0.valid());
- assert(!p.valid());
+ std::packaged_task<double(int, char)> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
index 18786f4eb7a26..3f11d670bede3 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
index 45048b747f7a4..7097d428962af 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -25,5 +27,6 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
int main()
{
- PT p { VPT{} };
+ PT p { VPT{} }; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
+ // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
index e4df4ec225e70..feb7657bed37e 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -18,7 +20,7 @@
#include <future>
#include <cassert>
-#include "../../test_allocator.h"
+#include "test_allocator.h"
struct A {};
typedef std::packaged_task<A(int, char)> PT;
@@ -26,5 +28,6 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
int main()
{
- PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}};
+ PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
+ // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
index 9884c49a6dc7e..97624f90f3dfe 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -14,33 +16,12 @@
// packaged_task(packaged_task&) = delete;
#include <future>
-#include <cassert>
-
-class A
-{
- long data_;
-public:
- explicit A(long i) : data_(i) {}
-
- long operator()(long i, long j) const {return data_ + i + j;}
-};
int main()
{
{
- std::packaged_task<double(int, char)> p0(A(5));
- std::packaged_task<double(int, char)> p(p0);
- assert(!p0.valid());
- assert(p.valid());
- std::future<double> f = p.get_future();
- p(3, 'a');
- assert(f.get() == 105.0);
- }
- {
std::packaged_task<double(int, char)> p0;
- std::packaged_task<double(int, char)> p(p0);
- assert(!p0.valid());
- assert(!p.valid());
+ std::packaged_task<double(int, char)> p(p0); // expected-error {{call to deleted constructor of 'std::packaged_task<double (int, char)>'}}
}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
index 76904962a778d..ed147d74895b1 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
index 2eee2cbc2d509..14ac7614bb8e5 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
index 3aac2b26bfc1d..39784876b8c31 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -19,7 +20,7 @@
#include <future>
#include <cassert>
-#include "../../test_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
class A
@@ -47,7 +48,7 @@ int main()
{
std::packaged_task<double(int, char)> p(std::allocator_arg,
test_allocator<A>(), A(5));
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<double> f = p.get_future();
p(3, 'a');
@@ -55,14 +56,14 @@ int main()
assert(A::n_copies == 0);
assert(A::n_moves > 0);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
A a(5);
std::packaged_task<double(int, char)> p(std::allocator_arg,
test_allocator<A>(), a);
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<double> f = p.get_future();
p(3, 'a');
@@ -70,31 +71,31 @@ int main()
assert(A::n_copies > 0);
assert(A::n_moves > 0);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
A a(5);
std::packaged_task<int(int)> p(std::allocator_arg, test_allocator<A>(), &func);
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<int> f = p.get_future();
p(4);
assert(f.get() == 4);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
A a(5);
std::packaged_task<int(int)> p(std::allocator_arg, test_allocator<A>(), func);
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<int> f = p.get_future();
p(4);
assert(f.get() == 4);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
index 88f0722817502..d9951dca585ab 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
index e24232d1b2276..7fafd10056490 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
index 13b5db110668e..c8e5d6efd6b42 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
index 61a6a4f87965c..54ac644582486 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
index 2a09353b1e63b..9ad1509517f64 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
index 9d38d9b409c09..02a567500ee2d 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
index 33763bef0d0f8..eb0091c8e8171 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
index 668732b9b24a1..d90d593a75bdf 100644
--- a/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
index 986f71e29a46d..bbe75de7f8a9c 100644
--- a/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
@@ -9,6 +9,12 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// This test is marked XFAIL and not UNSUPPORTED because the non-variadic
+// declaration of packaged_task is available in C++03. Therefore the test
+// should fail because the static_assert fires and not because std::packaged_task
+// in undefined.
+// XFAIL: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -18,7 +24,7 @@
// : true_type { };
#include <future>
-#include "../../test_allocator.h"
+#include "test_allocator.h"
int main()
{
diff --git a/test/std/thread/futures/futures.tas/types.pass.cpp b/test/std/thread/futures/futures.tas/types.pass.cpp
index dd1724ddbda5c..f7c9b223add1f 100644
--- a/test/std/thread/futures/futures.tas/types.pass.cpp
+++ b/test/std/thread/futures/futures.tas/types.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp b/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
index ebdcbf98d996d..781c9c9d61991 100644
--- a/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
+++ b/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
@@ -14,61 +14,36 @@
// future& operator=(const future&) = delete;
#include <future>
-#include <cassert>
+
+#include "test_macros.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
- typedef int T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int> f0, f;
+ f = f0; // expected-error {{overload resolution selected deleted operator '='}}
}
{
- typedef int T;
- std::future<T> f0;
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int &> f0, f;
+ f = f0; // expected-error {{overload resolution selected deleted operator '='}}
}
{
- typedef int& T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<void> f0, f;
+ f = f0; // expected-error {{overload resolution selected deleted operator '='}}
}
+#else
{
- typedef int& T;
- std::future<T> f0;
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int> f0, f;
+ f = f0; // expected-error {{'operator=' is a private member of 'std::__1::future<int>'}}
}
{
- typedef void T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int &> f0, f;
+ f = f0; // expected-error {{'operator=' is a private member of 'std::__1::future<int &>'}}
}
{
- typedef void T;
- std::future<T> f0;
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<void> f0, f;
+ f = f0; // expected-error {{'operator=' is a private member of 'std::__1::future<void>'}}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp b/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
index 8d43294edc263..0d7b5f5074d39 100644
--- a/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
@@ -14,53 +14,36 @@
// future(const future&) = delete;
#include <future>
-#include <cassert>
+
+#include "test_macros.h"
int main()
{
+#if TEST_STD_VER >= 11
{
- typedef int T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int> f0;
+ std::future<int> f = f0; // expected-error {{call to deleted constructor of 'std::future<int>'}}
}
{
- typedef int T;
- std::future<T> f0;
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int &> f0;
+ std::future<int &> f = f0; // expected-error {{call to deleted constructor of 'std::future<int &>'}}
}
{
- typedef int& T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<void> f0;
+ std::future<void> f = f0; // expected-error {{call to deleted constructor of 'std::future<void>'}}
}
+#else
{
- typedef int& T;
- std::future<T> f0;
- std::future<T> f = std::move(f0);
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int> f0;
+ std::future<int> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<int>'}}
}
{
- typedef void T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int &> f0;
+ std::future<int &> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<int &>'}}
}
{
- typedef void T;
- std::future<T> f0;
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<void> f0;
+ std::future<void> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<void>'}}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.unique_future/dtor.pass.cpp b/test/std/thread/futures/futures.unique_future/dtor.pass.cpp
index 5e9697bb939b9..03d7c915cb61f 100644
--- a/test/std/thread/futures/futures.unique_future/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,51 +20,51 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int T;
std::future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int& T;
std::future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef void T;
std::future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.unique_future/get.pass.cpp b/test/std/thread/futures/futures.unique_future/get.pass.cpp
index 758e38a7dae97..67b1052c175d1 100644
--- a/test/std/thread/futures/futures.unique_future/get.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/get.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/share.pass.cpp b/test/std/thread/futures/futures.unique_future/share.pass.cpp
index 794b5ce38feba..ef011d8df7529 100644
--- a/test/std/thread/futures/futures.unique_future/share.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/share.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/wait.pass.cpp b/test/std/thread/futures/futures.unique_future/wait.pass.cpp
index e10d37cf80646..f6de983f30570 100644
--- a/test/std/thread/futures/futures.unique_future/wait.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/wait.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp b/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
index 0a381d9ca2f0d..c4f3582684326 100644
--- a/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp b/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
index d5865b9b9dcf3..541c008607529 100644
--- a/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
@@ -1,129 +1,130 @@
- //===----------------------------------------------------------------------===//
- //
- // The LLVM Compiler Infrastructure
- //
- // This file is dual licensed under the MIT and the University of Illinois Open
- // Source Licenses. See LICENSE.TXT for details.
- //
- //===----------------------------------------------------------------------===//
- //
- // UNSUPPORTED: libcpp-has-no-threads
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
- // <future>
+// <future>
- // class future<R>
+// class future<R>
- // template <class Clock, class Duration>
- // future_status
- // wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+// template <class Clock, class Duration>
+// future_status
+// wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
- #include <future>
- #include <atomic>
- #include <cassert>
+#include <future>
+#include <atomic>
+#include <cassert>
- enum class WorkerThreadState { Uninitialized, AllowedToRun, Exiting };
- typedef std::chrono::milliseconds ms;
+enum class WorkerThreadState { Uninitialized, AllowedToRun, Exiting };
+typedef std::chrono::milliseconds ms;
- std::atomic<WorkerThreadState> thread_state(WorkerThreadState::Uninitialized);
+std::atomic<WorkerThreadState> thread_state(WorkerThreadState::Uninitialized);
- void set_worker_thread_state(WorkerThreadState state)
- {
- thread_state.store(state, std::memory_order_relaxed);
- }
+void set_worker_thread_state(WorkerThreadState state)
+{
+ thread_state.store(state, std::memory_order_relaxed);
+}
- void wait_for_worker_thread_state(WorkerThreadState state)
- {
- while (thread_state.load(std::memory_order_relaxed) != state);
- }
+void wait_for_worker_thread_state(WorkerThreadState state)
+{
+ while (thread_state.load(std::memory_order_relaxed) != state);
+}
- void func1(std::promise<int> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- p.set_value(3);
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
+void func1(std::promise<int> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ p.set_value(3);
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
- int j = 0;
+int j = 0;
- void func3(std::promise<int&> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- j = 5;
- p.set_value(j);
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
+void func3(std::promise<int&> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ j = 5;
+ p.set_value(j);
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
- void func5(std::promise<void> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- p.set_value();
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
+void func5(std::promise<void> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ p.set_value();
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
- int main()
- {
- typedef std::chrono::high_resolution_clock Clock;
- {
- typedef int T;
- std::promise<T> p;
- std::future<T> f = p.get_future();
- std::thread(func1, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
+int main()
+{
+ typedef std::chrono::high_resolution_clock Clock;
+ {
+ typedef int T;
+ std::promise<T> p;
+ std::future<T> f = p.get_future();
+ std::thread(func1, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- {
- typedef int& T;
- std::promise<T> p;
- std::future<T> f = p.get_future();
- std::thread(func3, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+ {
+ typedef int& T;
+ std::promise<T> p;
+ std::future<T> f = p.get_future();
+ std::thread(func3, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- {
- typedef void T;
- std::promise<T> p;
- std::future<T> f = p.get_future();
- std::thread(func5, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+ {
+ typedef void T;
+ std::promise<T> p;
+ std::future<T> f = p.get_future();
+ std::thread(func5, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- }
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+}
diff --git a/test/std/thread/futures/test_allocator.h b/test/std/thread/futures/test_allocator.h
deleted file mode 100644
index 50072909fa4e0..0000000000000
--- a/test/std/thread/futures/test_allocator.h
+++ /dev/null
@@ -1,158 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef TEST_ALLOCATOR_H
-#define TEST_ALLOCATOR_H
-
-#include <cstddef>
-#include <type_traits>
-#include <utility>
-#include <cstdlib>
-#include <new>
-#include <climits>
-
-class test_alloc_base
-{
-public:
- static int count;
-public:
- static int throw_after;
-};
-
-int test_alloc_base::count = 0;
-int test_alloc_base::throw_after = INT_MAX;
-
-template <class T>
-class test_allocator
- : public test_alloc_base
-{
- int data_;
-
- template <class U> friend class test_allocator;
-public:
-
- typedef unsigned size_type;
- typedef int difference_type;
- typedef T value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef typename std::add_lvalue_reference<value_type>::type reference;
- typedef typename std::add_lvalue_reference<const value_type>::type const_reference;
-
- template <class U> struct rebind {typedef test_allocator<U> other;};
-
- test_allocator() throw() : data_(-1) {}
- explicit test_allocator(int i) throw() : data_(i) {}
- test_allocator(const test_allocator& a) throw()
- : data_(a.data_) {}
- template <class U> test_allocator(const test_allocator<U>& a) throw()
- : data_(a.data_) {}
- ~test_allocator() throw() {data_ = 0;}
- pointer address(reference x) const {return &x;}
- const_pointer address(const_reference x) const {return &x;}
- pointer allocate(size_type n, const void* = 0)
- {
- if (count >= throw_after) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw std::bad_alloc();
-#else
- std::terminate();
-#endif
- }
- ++count;
- return (pointer)std::malloc(n * sizeof(T));
- }
- void deallocate(pointer p, size_type n)
- {--count; std::free(p);}
- size_type max_size() const throw()
- {return UINT_MAX / sizeof(T);}
- void construct(pointer p, const T& val)
- {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void construct(pointer p, T&& val)
- {::new(p) T(std::move(val));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void destroy(pointer p) {p->~T();}
-
- friend bool operator==(const test_allocator& x, const test_allocator& y)
- {return x.data_ == y.data_;}
- friend bool operator!=(const test_allocator& x, const test_allocator& y)
- {return !(x == y);}
-};
-
-template <>
-class test_allocator<void>
- : public test_alloc_base
-{
- int data_;
-
- template <class U> friend class test_allocator;
-public:
-
- typedef unsigned size_type;
- typedef int difference_type;
- typedef void value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
-
- template <class U> struct rebind {typedef test_allocator<U> other;};
-
- test_allocator() throw() : data_(-1) {}
- explicit test_allocator(int i) throw() : data_(i) {}
- test_allocator(const test_allocator& a) throw()
- : data_(a.data_) {}
- template <class U> test_allocator(const test_allocator<U>& a) throw()
- : data_(a.data_) {}
- ~test_allocator() throw() {data_ = 0;}
-
- friend bool operator==(const test_allocator& x, const test_allocator& y)
- {return x.data_ == y.data_;}
- friend bool operator!=(const test_allocator& x, const test_allocator& y)
- {return !(x == y);}
-};
-
-template <class T>
-class other_allocator
-{
- int data_;
-
- template <class U> friend class other_allocator;
-
-public:
- typedef T value_type;
-
- other_allocator() : data_(-1) {}
- explicit other_allocator(int i) : data_(i) {}
- template <class U> other_allocator(const other_allocator<U>& a)
- : data_(a.data_) {}
- T* allocate(std::size_t n)
- {return (T*)std::malloc(n * sizeof(T));}
- void deallocate(T* p, std::size_t n)
- {std::free(p);}
-
- other_allocator select_on_container_copy_construction() const
- {return other_allocator(-2);}
-
- friend bool operator==(const other_allocator& x, const other_allocator& y)
- {return x.data_ == y.data_;}
- friend bool operator!=(const other_allocator& x, const other_allocator& y)
- {return !(x == y);}
-
- typedef std::true_type propagate_on_container_copy_assignment;
- typedef std::true_type propagate_on_container_move_assignment;
- typedef std::true_type propagate_on_container_swap;
-
-#ifdef _LIBCPP_HAS_NO_ADVANCED_SFINAE
- std::size_t max_size() const
- {return UINT_MAX / sizeof(T);}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-
-};
-
-#endif // TEST_ALLOCATOR_H
diff --git a/test/std/thread/futures/version.pass.cpp b/test/std/thread/futures/version.pass.cpp
deleted file mode 100644
index 6730a1477db7a..0000000000000
--- a/test/std/thread/futures/version.pass.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// UNSUPPORTED: libcpp-has-no-threads
-
-// <future>
-
-#include <future>
-
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
-int main()
-{
-}