summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/thread/test/test_10963.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/thread/test/test_10963.cpp
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/thread/test/test_10963.cpp')
-rw-r--r--src/boost/libs/thread/test/test_10963.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/boost/libs/thread/test/test_10963.cpp b/src/boost/libs/thread/test/test_10963.cpp
new file mode 100644
index 00000000..1ec8d6cf
--- /dev/null
+++ b/src/boost/libs/thread/test/test_10963.cpp
@@ -0,0 +1,61 @@
+// Copyright (C) 2014 Vicente Botet
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_THREAD_VERSION 4
+#include <boost/config.hpp>
+#if ! defined BOOST_NO_CXX11_DECLTYPE
+#define BOOST_RESULT_OF_USE_DECLTYPE
+#endif
+#define BOOST_THREAD_PROVIDES_EXECUTORS
+
+#include <boost/thread/future.hpp>
+#include <boost/static_assert.hpp>
+#include <cassert>
+#include <boost/thread/executors/basic_thread_pool.hpp>
+
+
+struct TestCallback
+{
+ typedef boost::future<void> result_type;
+
+ result_type operator()(boost::future<void> future) const
+ {
+ assert(future.is_ready());
+ future.get();
+ return boost::make_ready_future();
+ }
+
+ result_type operator()(boost::future<boost::future<void> > future) const
+ {
+ assert(future.is_ready());
+ future.get();
+ return boost::make_ready_future();
+ }
+};
+
+int main()
+{
+#if ! defined BOOST_NO_CXX11_DECLTYPE && ! defined BOOST_NO_CXX11_AUTO_DECLARATIONS
+ {
+ boost::promise<void> test_promise;
+ boost::future<void> test_future(test_promise.get_future());
+ auto f1 = test_future.then(TestCallback());
+ BOOST_STATIC_ASSERT(std::is_same<decltype(f1), boost::future<boost::future<void> > >::value);
+ auto f2 = f1.then(TestCallback());
+ BOOST_STATIC_ASSERT(std::is_same<decltype(f2), boost::future<boost::future<void> > >::value);
+ }
+ {
+ boost::basic_thread_pool executor;
+ boost::promise<void> test_promise;
+ boost::future<void> test_future(test_promise.get_future());
+ auto f1 = test_future.then(executor, TestCallback());
+ BOOST_STATIC_ASSERT(std::is_same<decltype(f1), boost::future<boost::future<void> > >::value);
+ auto f2 = f1.then(executor, TestCallback());
+ BOOST_STATIC_ASSERT(std::is_same<decltype(f2), boost::future<boost::future<void> > >::value);
+
+ }
+#endif
+ return 0;
+}