]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/thread/test/sync/futures/promise/set_value_const_pass.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / thread / test / sync / futures / promise / set_value_const_pass.cpp
index e549eb6e012210804e3292be9fb22b3200818d4f..e4defb91bb8269ccecd8e627e9545e706f26f798 100644 (file)
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/static_assert.hpp>
 
+#ifdef BOOST_MSVC
+# pragma warning(disable: 4702) // unreachable code
+#endif
+
 struct A
 {
   A()
@@ -61,6 +65,30 @@ int main()
       BOOST_TEST(false);
     }
   }
+  {
+    typedef int T;
+    T i = 3;
+    boost::promise<T> p;
+    boost::future<T> f = p.get_future();
+    p.set_value_deferred(i);
+    p.notify_deferred();
+    ++i;
+    BOOST_TEST(f.get() == 3);
+    --i;
+    try
+    {
+      p.set_value(i);
+      BOOST_TEST(false);
+    }
+    catch (const boost::future_error& e)
+    {
+      BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::promise_already_satisfied));
+    }
+    catch (...)
+    {
+      BOOST_TEST(false);
+    }
+  }
   {
     typedef A T;
     T i;