title: What's with the copy-constructor if the class contains a user-declared destructor?
body: <p>The Standard in section 12.8/7 says:</p>
  
  <blockquote>
    <p>If the class definition does not explicitly declare a copy
    constructor, one is declared implicitly. If the class definition
    declares a move constructor or move assignment operator, the
    implicitly declared copy constructor is defined as deleted; otherwise,
    it is defined as defaulted (8.4). <em>The latter case is deprecated if the</em>
    <em>class has a user-declared copy assignment operator or a user-declared</em>
    <em>destructor</em>. Thus, for the class definition </p>
  
  <pre><code>struct X {
      X(const X&amp;, int);
  };
  </code></pre>
    
    <p>a copy constructor is implicitly-declared. If the user-declared
    constructor is later defined as </p>
  
  <pre><code>X::X(const X&amp; x, int i =0) { /∗ ... ∗/ }
  </code></pre>
  </blockquote>
  
  <p>I can't get the point of that <em>The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor.</em> In the example the Standard neither provides a user-declared copy assignment operator nor a destructor. What will happen if we declare a destructor or a copy assignment operator? I've tried to do that as follows:</p>
  
  <pre><code>struct A
  {
      ~A(){ };
  };
  
  A::A(const A&amp;){ }; //error
  
  int main(){ }
  </code></pre>
  
  <p><strong><a href="http://coliru.stacked-crooked.com/a/3f5045adf6c5eb84" rel="nofollow">DEMO</a></strong></p>
  
  <p>but in the example we still have the implicitly-declared copy constructor. What does that rule actual mean?</p>
  
  <p>I thought that if we write the following:</p>
  
  <pre><code>struct A
  {
      A(){ };
      A(const A&amp;&amp;){ };
      ~A(){ };
  };
  
  A a;
  
  A t = a; //error: call to implicitly-deleted copy constructor of 'A'
  
  int main()
  { 
  
  }
  </code></pre>
  
  <p><strong><a href="http://coliru.stacked-crooked.com/a/4b51a6d555b815cd" rel="nofollow">DEMO</a></strong></p>
  
  <p>the copy-constructor won't explicitly deleted. But thats's not the case.</p>