+2020-03-16 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/94199
+ * include/experimental/executor (service_already_exists): Add default
+ constructor. Declare make_service to be a friend.
+ * testsuite/experimental/net/execution_context/make_service.cc: New
+ test.
+
2020-03-12 Jonathan Wakely <jwakely@redhat.com>
* testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Do not pass
/// An extensible, type-safe, polymorphic set of services.
class execution_context;
- class service_already_exists : public logic_error { };
+ class service_already_exists : public logic_error
+ {
+ template<typename _Service, typename... _Args>
+ friend _Service&
+ make_service(execution_context&, _Args&&...);
+
+ service_already_exists() : logic_error("service already exists") { }
+ };
template<typename _Tp> struct is_executor;
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++14 } }
+
+#include <experimental/executor>
+
+namespace net = std::experimental::net;
+
+struct S : net::execution_context::service
+{
+ using key_type = S;
+
+ S(net::execution_context&);
+
+ void shutdown() noexcept override { }
+};
+
+void test01(net::execution_context& c)
+{
+ net::make_service<S>(c);
+}