<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2754: The in_place constructors and emplace functions added by P0032R3 don't require CopyConstructible</title>
<meta property="og:title" content="Issue 2754: The in_place constructors and emplace functions added by P0032R3 don't require CopyConstructible">
<meta property="og:description" content="C++ library issue. Status: Resolved">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2754.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="2754"><a href="lwg-defects.html#2754">2754</a>. The <code>in_place</code> constructors and <code>emplace</code> functions added by P0032R3 don't require <code>CopyConstructible</code></h3>
<p><b>Section:</b> 22.7.4.2 <a href="https://wg21.link/any.cons">[any.cons]</a>, 22.7.4.3 <a href="https://wg21.link/any.assign">[any.assign]</a>, 22.7.4.4 <a href="https://wg21.link/any.modifiers">[any.modifiers]</a> <b>Status:</b> <a href="lwg-active.html#Resolved">Resolved</a>
 <b>Submitter:</b> Ville Voutilainen <b>Opened:</b> 2016-07-05 <b>Last modified:</b> 2020-09-06</p>
<p><b>Priority: </b>1
</p>
<p><b>View all other</b> <a href="lwg-index.html#any.cons">issues</a> in [any.cons].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#Resolved">Resolved</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The <code>in_place</code> constructors and <code>emplace</code> functions
added by <a href="https://wg21.link/p0032r3">P0032R3</a> don't require <code>CopyConstructible</code>.
<p/>
They must. Otherwise copying an <code>any</code> that's made to hold a non-<code>CopyConstructible</code>
type must fail with a run-time error. Since that's crazy, we want to prevent
storing non-<code>CopyConstructible</code> types in an <code>any</code>.
<p/>
Previously, the requirement for <code>CopyConstructible</code> was just on the converting
constructor template and the converting assignment operator template on <code>any</code>.
Now that we are adding two <code>in_place</code> constructor overloads and two
<code>emplace</code> overloads, it seems reasonable to require <code>CopyConstructible</code> in some more 
general location, in order to avoid repeating that requirement all over the place.
</p>

<p><i>[2016-07 &mdash; Chicago]</i></p>

<p>Monday: P1</p>
<p>Tuesday: Ville/Billy/Billy provide wording</p>

<p><i>[2016-08-02: Daniel comments]</i></p>

<p>
The P/R wording of this issue brought to my intention that the recently added <code>emplace</code> functions
of <code>std::any</code> introduced a breakage of a previous class invariant that only a <code>decay</code>ed type could
be stored as object into an <code>any</code>, this prevented storing arrays, references, functions, and <i>cv</i>-qualified
types. The new constraints added my Ville do prevent some of these types (e.g. neither arrays nor functions meet
the <code>CopyConstructible</code> requirements), but we need to cope with <i>cv</i>-qualified types and reference types.
</p>

<p><i>[2016-08-02: Agust&iacute;n K-ballo Berg&eacute; comments]</i></p>

<p>
Presumably the constructors <code>any(in_place_type_t&lt;T&gt;, ...)</code> would need to be modified in the same way 
the <code>emplace</code> overloads were.
</p>

<p><i>[2016-08-02: Ville adjusts the P/R to cope with the problems pointed out by Daniel's and Agust&iacute;n's comments]</i></p>

<p>Ville notes that <a href="lwg-active.html#2746" title="Inconsistency between requirements for emplace between optional and variant (Status: New)">2746</a><sup><a href="https://cplusplus.github.io/LWG/issue2746" title="Latest snapshot">(i)</a></sup>, <a href="lwg-defects.html#2754" title="The in_place constructors and emplace functions added by P0032R3 don't require CopyConstructible (Status: Resolved)">2754</a><sup><a href="https://cplusplus.github.io/LWG/issue2754" title="Latest snapshot">(i)</a></sup> and <a href="lwg-defects.html#2756" title="C++ WP optional&lt;T&gt; should 'forward' T's implicit conversions (Status: C++17)">2756</a><sup><a href="https://cplusplus.github.io/LWG/issue2756" title="Latest snapshot">(i)</a></sup> all go together.</p>

<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
This wording is relative to N4606.
</p>
<blockquote class="note">
<p>
Drafting note: this P/R doesn't turn the <i>Requires</i>-clauses into <i>Remarks</i>-clauses.
We might want to do that separately, because SFINAEing the constructors
allows users to query for <code>is_constructible</code> and get the right answer. Failing
to mandate the SFINAE will lead to non-portable answers for <code>is_constructible</code>.
Currently, libstdc++ SFINAEs. That should be done as a separate issue,
as this issue is an urgent bug-fix but the mandated SFINAE is not.
</p>
</blockquote>

<ol>
<li><p>Change 22.7.4 <a href="https://wg21.link/any.class">[any.class]</a>, class <code>any</code> synopsis, as indicated:</p>

<blockquote>
<pre>
class any {
public:
  [&hellip;]
  template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
    explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, Args&amp;&amp;...);
  template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
    explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, initializer_list&lt;U&gt;, Args&amp;&amp;...);
    
  [&hellip;]
  template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
    void emplace(Args&amp;&amp; ...);
  template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
    void emplace(initializer_list&lt;U&gt;, Args&amp;&amp;...);
  [&hellip;]
};
</pre>
</blockquote>
</li>

<li><p>Change 22.7.4.2 <a href="https://wg21.link/any.cons">[any.cons]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class ValueType&gt;
  any(ValueType&amp;&amp; value);
</pre>
<blockquote>
<p>
-6- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.
<p/>
-7- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements. 
<del>If <code>is_copy_constructible_v&lt;T&gt;</code> is <code>false</code>, the program is ill-formed.</del>
<p/>
[&hellip;]
<p/>
-9- <i>Remarks:</i> This constructor shall not participate in overload resolution <del>if</del><ins>unless</ins> 
<code>decay_t&lt;ValueType&gt;</code> is <ins>not</ins> the same type as <code>any</code> <ins>and 
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code></ins>.
</p>
</blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
  explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>remove_cv_t&lt;ValueType&gt;</code>.</ins>
<p/>
-11- <i>Requires:</i> <ins><code>T</code> shall satisfy the <code>CopyConstructible</code> requirements</ins>
<del><code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
<ins>-?- <i>Remarks:</i> This constructor shall not participate in overload resolution
unless <code>is_reference_v&lt;T&gt;</code> is <code>false</code>, <code>is_array_v&lt;T&gt;</code> is <code>false</code>,
<code>is_function_v&lt;T&gt;</code> is <code>false</code>, <code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> 
and <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code>.</ins>
</p>
</blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
  explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, initializer_list&lt;U&gt; il, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>remove_cv_t&lt;ValueType&gt;</code>.</ins>
<p/>
-15- <i>Requires:</i> <ins><code>T</code> shall satisfy the <code>CopyConstructible</code> requirements</ins>
<del><code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
-19- <i>Remarks:</i> The function shall not participate in overload resolution unless 
<ins><code>is_reference_v&lt;T&gt;</code> is <code>false</code>, <code>is_array_v&lt;T&gt;</code> is <code>false</code>,
<code>is_function_v&lt;T&gt;</code> is <code>false</code>, <code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> 
and</ins> <code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Change 22.7.4.3 <a href="https://wg21.link/any.assign">[any.assign]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class ValueType&gt;
  any&amp; operator=(ValueType&amp;&amp; rhs);
</pre>
<blockquote>
<p>
-7- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.
<p/>
-8- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements. <del>If 
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>false</code>, the program is ill-formed.</del>
<p/>
[&hellip;]
<p/>
-11- <i>Remarks:</i> This operator shall not participate in overload resolution <del>if</del><ins>unless</ins> 
<code>decay_t&lt;ValueType&gt;</code> is <ins>not</ins> the same type as <code>any</code> <ins>and
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code></ins>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Change 22.7.4.4 <a href="https://wg21.link/any.modifiers">[any.modifiers]</a> as indicated:</p>

<blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
  void emplace(Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>remove_cv_t&lt;ValueType&gt;</code>.</ins>
<p/>
-1- <i>Requires:</i> <ins><code>T</code> shall satisfy the <code>CopyConstructible</code> requirements</ins>
<del><code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
-5- <i>Remarks:</i> If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> does not 
contain a value, and any previously contained object has been destroyed. <ins>This function shall not participate 
in overload resolution unless <code>is_reference_v&lt;T&gt;</code> is <code>false</code>, <code>is_array_v&lt;T&gt;</code> is 
<code>false</code>, <code>is_function_v&lt;T&gt;</code> is <code>false</code>, <code>is_copy_constructible_v&lt;T&gt;</code> is 
<code>true</code> and <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code>.</ins>
</p>
</blockquote>

<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
  void emplace(initializer_list&lt;U&gt; il, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>remove_cv_t&lt;ValueType&gt;</code>.</ins>
<p/>
<ins>-?- <i>Requires</i>: <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements.</ins>
<p/>
-6- <i>Effects:</i> [&hellip;]
<p/>
[&hellip;]
<p/>
-9- <i>Remarks:</i> If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> does 
not contain a value, and any previously contained object has been destroyed. The function shall not participate in overload
resolution unless <ins><code>is_reference_v&lt;T&gt;</code> is <code>false</code>, <code>is_array_v&lt;T&gt;</code> is <code>false</code>,
<code>is_function_v&lt;T&gt;</code> is <code>false</code>, <code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> and</ins> 
<code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>
</ol>
</blockquote>

<p><i>[2016-08-03: Ville comments and revises his proposed wording]</i></p>

<p>
After discussing the latest P/R, here's an update. What this update does is that:
</p>
<ol>
<li><p>It strikes the <i>Requires</i>-clauses and does <em>not</em> add
<code>CopyConstructible</code> to the <i>Requires</i>-clauses.
<p/>
Rationale: <code>any</code> doesn't care whether the type it holds satisfies the
semantic requirements of the <code>CopyConstructible</code> concept. The syntactic 
requirements are now SFINAE constraints in <i>Requires</i>-clauses.</p></li>
<li><p>It reverts back towards <code>decay_t</code> rather than <code>remove_cv_t</code>, and does
<em>not</em> add the suggested SFINAE constraints for <code>is_reference</code>/<code>is_array</code>/<code>is_function</code>.
<p/>
Rationale:
</p>
<ol style="list-style-type:lower-alpha">
<li><p><code>any</code> decays by design. It's to some extent inconsistent
to not protect against decay in the <code>ValueType</code> constructor/assignment operator, but to protect
against decay in the <code>in_place_t</code> constructors and <code>emplace</code> functions</p></li>
<li><p>I think it's saner to just decay than to potentially run into
situations where I need to <code>remove_reference</code> inside <code>in_place_t</code>.</p></li>
</ol>
</li>
</ol>
<p>
Based on that, this P/R should supersede the previous one. We want to
look at this new P/R in LWG and potentially send it to LEWG for verification. 
Personally, I think this P/R is the more conservative one, doesn't add 
significant new functionality, and is consistent, and is
thus not really Library-Evolutionary.
</p>

<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
This wording is relative to N4606.
</p>

<ol>
<li><p>Change 22.7.4 <a href="https://wg21.link/any.class">[any.class]</a>, class <code>any</code> synopsis, as indicated:</p>

<blockquote>
<pre>
class any {
public:
  [&hellip;]
  template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
    explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, Args&amp;&amp;...);
  template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
    explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, initializer_list&lt;U&gt;, Args&amp;&amp;...);
    
  [&hellip;]
  template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
    void emplace(Args&amp;&amp; ...);
  template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
    void emplace(initializer_list&lt;U&gt;, Args&amp;&amp;...);
  [&hellip;]
};
</pre>
</blockquote>
</li>

<li><p>Change 22.7.4.2 <a href="https://wg21.link/any.cons">[any.cons]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class ValueType&gt;
  any(ValueType&amp;&amp; value);
</pre>
<blockquote>
<p>
-6- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.
<p/>
<del>-7- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements. 
If <code>is_copy_constructible_v&lt;T&gt;</code> is <code>false</code>, the program is ill-formed.</del>
<p/>
[&hellip;]
<p/>
-9- <i>Remarks:</i> This constructor shall not participate in overload resolution <del>if</del><ins>unless</ins> 
<code>decay_t&lt;ValueType&gt;</code> is <ins>not</ins> the same type as <code>any</code> <ins>and 
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code></ins>.
</p>
</blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
  explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
<del>-11- <i>Requires:</i> <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
<ins>-?- <i>Remarks:</i> This constructor shall not participate in overload resolution
unless <code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> 
and <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code>.</ins>
</p>
</blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
  explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, initializer_list&lt;U&gt; il, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
<del>-15- <i>Requires:</i> <code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
-19- <i>Remarks:</i> The function shall not participate in overload resolution unless 
<ins><code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> 
and</ins> <code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Change 22.7.4.3 <a href="https://wg21.link/any.assign">[any.assign]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class ValueType&gt;
  any&amp; operator=(ValueType&amp;&amp; rhs);
</pre>
<blockquote>
<p>
-7- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.
<p/>
<del>-8- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements. If 
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>false</code>, the program is ill-formed.</del>
<p/>
[&hellip;]
<p/>
-11- <i>Remarks:</i> This operator shall not participate in overload resolution <del>if</del><ins>unless</ins> 
<code>decay_t&lt;ValueType&gt;</code> is <ins>not</ins> the same type as <code>any</code> <ins>and
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code></ins>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Change 22.7.4.4 <a href="https://wg21.link/any.modifiers">[any.modifiers]</a> as indicated:</p>

<blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
  void emplace(Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
<del>-1- <i>Requires:</i> <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
-5- <i>Remarks:</i> If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> does not 
contain a value, and any previously contained object has been destroyed. <ins>This function shall not participate 
in overload resolution unless <code>is_copy_constructible_v&lt;T&gt;</code> is 
<code>true</code> and <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code>.</ins>
</p>
</blockquote>

<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
  void emplace(initializer_list&lt;U&gt; il, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be equal to <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
-6- <i>Effects:</i> [&hellip;]
<p/>
[&hellip;]
<p/>
-9- <i>Remarks:</i> If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> does 
not contain a value, and any previously contained object has been destroyed. The function shall not participate in overload
resolution unless <ins><code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> and</ins> 
<code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>
</ol>
</blockquote>

<p><i>[2016-08-03: Ville comments and revises his proposed wording]</i></p>

<p>
This P/R brings back the <code>CopyConstructible</code> parts of the relevant
Requires-clauses but removes the other parts of the Requires-clauses.
</p>
<p><i>[2016-08 - Chicago]</i></p>

<p>Thurs PM: Moved to Tentatively Ready</p>

<p><i>[2016-11 - Issaquah]</i></p>

<p>Approved in plenary.</p>
<p>After plenary, there was concern about applying both this and <a href="lwg-defects.html#2744" title="any's in_place constructors (Status: C++17)">2744</a><sup><a href="https://cplusplus.github.io/LWG/issue2744" title="Latest snapshot">(i)</a></sup>,
so it was moved back to "Open". Then, when the concerns were resolved, moved to "Resolved".</p>


<p id="res-2754"><b>Proposed resolution:</b></p>
<p>
This wording is relative to N4606.
</p>

<ol>
<li><p>Change 22.7.4 <a href="https://wg21.link/any.class">[any.class]</a>, class <code>any</code> synopsis, as indicated:</p>

<blockquote>
<pre>
class any {
public:
  [&hellip;]
  template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
    explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, Args&amp;&amp;...);
  template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
    explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, initializer_list&lt;U&gt;, Args&amp;&amp;...);
    
  [&hellip;]
  template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
    void emplace(Args&amp;&amp; ...);
  template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
    void emplace(initializer_list&lt;U&gt;, Args&amp;&amp;...);
  [&hellip;]
};
</pre>
</blockquote>
</li>

<li><p>Change 22.7.4.2 <a href="https://wg21.link/any.cons">[any.cons]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class ValueType&gt;
  any(ValueType&amp;&amp; value);
</pre>
<blockquote>
<p>
-6- Let <code>T</code> be <code>decay_t&lt;ValueType&gt;</code>.
<p/>
-7- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements. 
<del>If <code>is_copy_constructible_v&lt;T&gt;</code> is <code>false</code>, the program is ill-formed.</del>
<p/>
[&hellip;]
<p/>
-9- <i>Remarks:</i> This constructor shall not participate in overload resolution <del>if</del><ins>unless</ins> 
<code><ins>T</ins><del>decay_t&lt;ValueType&gt;</del></code> is <ins>not</ins> the same type as <code>any</code> <ins>and 
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code></ins>.
</p>
</blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
  explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
-11- <i>Requires:</i> <ins><code>T</code> shall satisfy the <code>CopyConstructible</code> 
requirements</ins><del><code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
<ins>-?- <i>Remarks:</i> This constructor shall not participate in overload resolution
unless <code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> 
and <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code>.</ins>
</p>
</blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
  explicit any(in_place_type_t&lt;<del>T</del><ins>ValueType</ins>&gt;, initializer_list&lt;U&gt; il, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
-15- <i>Requires:</i> <ins><code>T</code> shall satisfy the <code>CopyConstructible</code> 
requirements</ins><del><code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
-19- <i>Remarks:</i> The function shall not participate in overload resolution unless 
<ins><code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> 
and</ins> <code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Change 22.7.4.3 <a href="https://wg21.link/any.assign">[any.assign]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class ValueType&gt;
  any&amp; operator=(ValueType&amp;&amp; rhs);
</pre>
<blockquote>
<p>
-7- Let <code>T</code> be <code>decay_t&lt;ValueType&gt;</code>.
<p/>
-8- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements. <del>If 
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>false</code>, the program is ill-formed.</del>
<p/>
[&hellip;]
<p/>
-11- <i>Remarks:</i> This operator shall not participate in overload resolution <del>if</del><ins>unless</ins> 
<code><ins>T</ins><del>decay_t&lt;ValueType&gt;</del></code> is <ins>not</ins> the same type as <code>any</code> <ins>and
<code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code></ins>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Change 22.7.4.4 <a href="https://wg21.link/any.modifiers">[any.modifiers]</a> as indicated:</p>

<blockquote>
<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class... Args&gt;
  void emplace(Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
-1- <i>Requires:</i> <ins><code>T</code> shall satisfy the <code>CopyConstructible</code> 
requirements</ins><del><code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code></del>.
<p/>
[&hellip;]
<p/>
-5- <i>Remarks:</i> If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> does not 
contain a value, and any previously contained object has been destroyed. <ins>This function shall not participate 
in overload resolution unless <code>is_copy_constructible_v&lt;T&gt;</code> is 
<code>true</code> and <code>is_constructible_v&lt;T, Args...&gt;</code> is <code>true</code>.</ins>
</p>
</blockquote>

<pre>
template &lt;class <del>T</del><ins>ValueType</ins>, class U, class... Args&gt;
  void emplace(initializer_list&lt;U&gt; il, Args&amp;&amp;... args);
</pre>
<blockquote>
<p>
<ins>-?- Let <code>T</code> be <code>decay_t&lt;ValueType&gt;</code>.</ins>
<p/>
<ins>-?- <i>Requires:</i> <code>T</code> shall satisfy the <code>CopyConstructible</code> requirements.</ins>
<p/>
-6- <i>Effects:</i> [&hellip;]
<p/>
[&hellip;]
<p/>
-9- <i>Remarks:</i> If an exception is thrown during the call to <code>T</code>'s constructor, <code>*this</code> does 
not contain a value, and any previously contained object has been destroyed. The function shall not participate in overload
resolution unless <ins><code>is_copy_constructible_v&lt;T&gt;</code> is <code>true</code> and</ins> 
<code>is_constructible_v&lt;T, initializer_list&lt;U&gt;&amp;, Args...&gt;</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>
</ol>





</body>
</html>
