Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / beast / test / beast / core / basic_stream.cpp
index f4f6a58..4b64c79 100644 (file)
@@ -1260,6 +1260,44 @@ public:
     //--------------------------------------------------------------------------
 
     void
+    testIssue1589()
+    {
+        net::io_context ioc;
+
+        // the timer needlessly used polymorphic executor
+        basic_stream<
+            net::ip::tcp,
+            net::io_context::executor_type>{ioc};
+
+        // make sure strands work
+        basic_stream<
+            net::ip::tcp,
+            net::strand<
+                net::io_context::executor_type>>{
+                    net::make_strand(ioc)};
+
+        // address the problem in the issue
+        {
+            net::basic_stream_socket<
+                net::ip::tcp,
+                net::strand<
+                    net::io_context::executor_type>
+                        > sock(net::make_strand(ioc));
+            basic_stream<
+                net::ip::tcp,
+                net::strand<
+                    net::io_context::executor_type>,
+                unlimited_rate_policy> stream(std::move(sock));
+            BOOST_STATIC_ASSERT(
+                std::is_convertible<
+                    decltype(sock)::executor_type,
+                    decltype(stream)::executor_type>::value);
+        }
+    }
+
+    //--------------------------------------------------------------------------
+
+    void
     run()
     {
         testSpecialMembers();
@@ -1268,6 +1306,7 @@ public:
         testConnect();
         testMembers();
         testJavadocs();
+        testIssue1589();
     }
 };