<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3414: [networking.ts] service_already_exists has no usable constructors</title>
<meta property="og:title" content="Issue 3414: [networking.ts] service_already_exists has no usable constructors">
<meta property="og:description" content="C++ library issue. Status: C++23">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3414.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++23">C++23</a> status.</em></p>
<h3 id="3414"><a href="lwg-defects.html#3414">3414</a>. [networking.ts] <code>service_already_exists</code> has no usable constructors</h3>
<p><b>Section:</b> 13.7 [networking.ts::async.exec.ctx] <b>Status:</b> <a href="lwg-active.html#C++23">C++23</a>
 <b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2020-03-17 <b>Last modified:</b> 2023-11-22</p>
<p><b>Priority: </b>0
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++23">C++23</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses: networking.ts</b></p>
<p>
In the Networking TS, the <code>service_already_exists</code> exception type
has no constructors declared. The <code>logic_error</code> base class is not
default constructible, so <code>service_already_exists</code>'s implicit default
constructor is defined as deleted.
</p>
<p>
Implementations can add one or more private constructors that can be used
by <code>make_service</code>, but there seems to be little benefit to that.
The Boost.Asio type of the same name has a public default constructor.
</p>

<p><i>[2020-04-18 Issue Prioritization]</i></p>
 
<p>
Status set to Tentatively Ready after six positive votes on the reflector.
</p>
<p><i>[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready &rarr; WP.]</i></p>



<p id="res-3414"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/n4734">N4734</a>.
</p>

<ol>
<li><p>Modify 13.7 [networking.ts::async.exec.ctx] p1, as indicated:</p>

<blockquote>
<pre>
<i>// service access</i>
template&lt;class Service> typename Service::key_type&amp;
use_service(execution_context&amp; ctx);
template&lt;class Service, class... Args&gt; Service&amp;
make_service(execution_context&amp; ctx, Args&amp;&amp;... args);
template&lt;class Service&gt; bool has_service(const execution_context&amp; ctx) noexcept;
class service_already_exists : public logic_error <del>{ };</del>
<ins>{
public:
  service_already_exists();
};</ins>
</pre>
</blockquote>
</li>

<li>
<p>Add a new subclause after [async.exec.ctx.globals]:</p>

<blockquote>
<p>
<b>13.7.6 Class <code>service_already_exists</code> [async.exec.ctx.except]</b>
</p>

<p>
-1- The class <code>service_already_exists</code> defines the type of objects
thrown as exceptions to report an attempt to add an existing service
to an <code>execution_context</code>.
</p>
<pre>
service_already_exists();
</pre>
<blockquote>
<p>-2- <i>Postconditions:</i> <code>what()</code> returns an implementation-defined NTBS.</p>
</blockquote>
</blockquote>
</li>

</ol>




</body>
</html>
