<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3458: Is shared_future intended to work with arrays or function types?</title>
<meta property="og:title" content="Issue 3458: Is shared_future intended to work with arrays or function types?">
<meta property="og:description" content="C++ library issue. Status: Resolved">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3458.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#Resolved">Resolved</a> status.</em></p>
<h3 id="3458"><a href="lwg-defects.html#3458">3458</a>. Is <code>shared_future</code> intended to work with arrays or function types?</h3>
<p><b>Section:</b> 32.10.7 <a href="https://wg21.link/futures.unique.future">[futures.unique.future]</a>, 32.10.8 <a href="https://wg21.link/futures.shared.future">[futures.shared.future]</a> <b>Status:</b> <a href="lwg-active.html#Resolved">Resolved</a>
 <b>Submitter:</b> Tomasz Kami&nacute;ski <b>Opened:</b> 2020-06-28 <b>Last modified:</b> 2020-11-09</p>
<p><b>Priority: </b>0
</p>
<p><b>View all other</b> <a href="lwg-index.html#futures.unique.future">issues</a> in [futures.unique.future].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#Resolved">Resolved</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Currently there is no prohibition of creating <code>shared_future&lt;T&gt;</code> where <code>T</code> is 
either an array type or a function type. However such objects cannot be constructed, as the corresponding 
<code>future&lt;T&gt;</code>, is ill-formed due the signature <code>get()</code> method being ill-formed &mdash; 
it will be declared as function returning an array or function type, respectively. [<i>Note:</i> For 
<code>shared_future</code> <code>get</code> always returns an reference, so it is well-formed for array or function 
types.]
</p>

<p><i>[2020-07-17; Reflector prioritization]</i></p>

<p>
Set priority to 0 and status to Tentatively Ready after six votes in favour during reflector discussions.
</p>

<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
This wording is relative to <a href="https://wg21.link/n4861">N4861</a>. 
</p>

<blockquote class="note">
<p>
Ideally the wording below would use a <i>Mandates:</i> element, but due to the still open
issue LWG <a href="lwg-active.html#3193" title="Mandates: and Expects: elements are not defined for types (Status: New)">3193</a><sup><a href="https://cplusplus.github.io/LWG/issue3193" title="Latest snapshot">(i)</a></sup> the wording below uses instead the more general "ill-formed"
vocabulary.
</p>
</blockquote>

<ol>
<li><p>Modify 32.10.7 <a href="https://wg21.link/futures.unique.future">[futures.unique.future]</a> as indicated:</p>

<blockquote>
<blockquote>
<pre>
namespace std {
  template&lt;class R&gt;
  class future {
    [&hellip;]
  };
}
</pre>
</blockquote>
<p>
<ins>-?- If <code>is_array_v&lt;R&gt;</code> is <code>true</code> or <code>is_function_v&lt;R&gt;</code> is <code>true</code>, 
the program is ill-formed.</ins>
<p/>
-4- The implementation provides the template <code>future</code> and two specializations, <code>future&lt;R&amp;&gt;</code> and 
<code>future&lt;void&gt;</code>. These differ only in the return type and return value of the member function <code>get</code>, 
as set out in its description, below.
</p>
</blockquote>
</li>

<li><p>Modify 32.10.8 <a href="https://wg21.link/futures.shared.future">[futures.shared.future]</a> as indicated:</p>

<blockquote>
<blockquote>
<pre>
namespace std {
  template&lt;class R&gt;
  class shared_future {
    [&hellip;]
  };
}
</pre>
</blockquote>
<p>
<ins>-?- If <code>is_array_v&lt;R&gt;</code> is <code>true</code> or <code>is_function_v&lt;R&gt;</code> is <code>true</code>, 
the program is ill-formed.</ins>
<p/>
-4- The implementation provides the template <code>shared_future</code> and two specializations, 
<code>shared_future&lt;R&amp;&gt;</code> and <code>shared_future&lt;void&gt;</code>. These differ only in the return type 
and return value of the member function <code>get</code>, as set out in its description, below.
</p>
</blockquote>
</li>
</ol>
</blockquote> 

<p><i>[2020-08-02; Daniel comments]</i></p>

<p>
I'm request to reopen the issue and to follow the recent wording update of LWG <a href="lwg-defects.html#3466" title="Specify the requirements for promise/future/shared_future consistently (Status: C++23)">3466</a><sup><a href="https://cplusplus.github.io/LWG/issue3466" title="Latest snapshot">(i)</a></sup> instead.
</p>
<p><i>[2020-11-09 Resolved by acceptance of <a href="lwg-defects.html#3466" title="Specify the requirements for promise/future/shared_future consistently (Status: C++23)">3466</a><sup><a href="https://cplusplus.github.io/LWG/issue3466" title="Latest snapshot">(i)</a></sup>. Status changed: Tentatively Resolved &rarr; Resolved.]</i></p>



<p id="res-3458"><b>Proposed resolution:</b></p>
<p>
Resolved by <a href="lwg-defects.html#3466" title="Specify the requirements for promise/future/shared_future consistently (Status: C++23)">3466</a><sup><a href="https://cplusplus.github.io/LWG/issue3466" title="Latest snapshot">(i)</a></sup>
</p>





</body>
</html>
