<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 822: Object with explicit copy constructor no longer CopyConstructible</title>
<meta property="og:title" content="Issue 822: Object with explicit copy constructor no longer CopyConstructible">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue822.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#NAD">NAD</a> status.</em></p>
<h3 id="822"><a href="lwg-closed.html#822">822</a>. Object with explicit copy constructor no longer <code>CopyConstructible</code></h3>
<p><b>Section:</b> 16.4.4.2 <a href="https://wg21.link/utility.arg.requirements">[utility.arg.requirements]</a> <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> James Kanze <b>Opened:</b> 2008-04-01 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View other</b> <a href="lwg-index-open.html#utility.arg.requirements">active issues</a> in [utility.arg.requirements].</p>
<p><b>View all other</b> <a href="lwg-index.html#utility.arg.requirements">issues</a> in [utility.arg.requirements].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>
<p>
I just noticed that the following program is legal in C++03, but
is forbidden in the current draft:
</p>

<blockquote><pre>
#include &lt;vector&gt;
#include &lt;iostream&gt;

class Toto
{
public:
    Toto() {}
    explicit Toto( Toto const&amp; ) {}
} ;

int
main()
{
    std::vector&lt; Toto &gt; v( 10 ) ;
    return 0 ;
}
</pre></blockquote>

<p>
Is this change intentional?  (And if so, what is the
justification?  I wouldn't call such code good, but I don't see
any reason to break it unless we get something else in return.)
</p>

<p><i>[
San Francisco:
]</i></p>


<blockquote><p>
The subgroup that looked at this felt this was a good change, but it may
already be handled by incoming concepts (we're not sure).
</p></blockquote>

<p><i>[
Post Summit:
]</i></p>


<blockquote>
<p>
Alisdair: Proposed resolution kinda funky as these tables no longer
exist. Move from direct init to copy init. Clarify with Doug, recommends
NAD.
</p>
<p>
Walter: Suggest NAD via introduction of concepts.
</p>
<p>
Recommend close as NAD.
</p>
</blockquote>

<p><i>[
2009-07 Frankfurt:
]</i></p>


<blockquote><p>
Need to look at again without concepts.
</p></blockquote>

<p><i>[
2009-07 Frankfurt:
]</i></p>


<blockquote>
<p>
Move to Ready with original proposed resolution.
</p>
<p><i>[Howard:  Original proposed resolution restored.]</i></p>

</blockquote>

<p><i>[
2010-11 Batavia:
]</i></p>

<p>
This issue was re-reviewed in relation to [another issue, number to follow],
and the verdict was reversed.  Explicit copy and move constructors are rare
beasts, and the ripple effect of this fix was far more difficult to contain
than simply saying such types do not satisfy the <code>MoveConstructible</code>
and <code>CopyConstructible</code> requirements.
</p>

<blockquote>
<p>
In 16.4.4.2 <a href="https://wg21.link/utility.arg.requirements">[utility.arg.requirements]</a> change Table 33: <code>MoveConstructible</code> requirements [moveconstructible]:
</p>

<blockquote>
<table border="1">
<tr>
<th>expression</th><th>post-condition</th>
</tr>
<tr>
<td><code>T t<ins>(rv)</ins><del> = rv</del></code></td><td><code>t</code> is equivalent to the value of <code>rv</code> before the construction</td>
</tr>
<tr>
<td colspan="2" align="center">...</td>
</tr>
</table>
</blockquote>

<p>
In 16.4.4.2 <a href="https://wg21.link/utility.arg.requirements">[utility.arg.requirements]</a> change Table 34: <code>CopyConstructible</code> requirements [copyconstructible]:
</p>

<blockquote>
<table border="1">
<tr>
<th>expression</th><th>post-condition</th>
</tr>
<tr>
<td><code>T t<ins>(u)</ins><del> = u</del></code></td><td>the value of <code>u</code> is unchanged and is equivalent to <code>t</code></td>
</tr>
<tr>
<td colspan="2" align="center">...</td>
</tr>
</table>
</blockquote>

</blockquote>



<p id="res-822"><b>Proposed resolution:</b></p><p>
Resolved by <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3215.htm">n3215</a>.
</p>




</body>
</html>
