title: Understanding copy-initialisation and implicit conversions
body: <p>I am having trouble understanding why the following copy-initialization doesn't compile:</p>
  
  <pre><code>#include &lt;memory&gt;
  
  struct base{};
  struct derived : base{};
  
  struct test
  {
      test(std::unique_ptr&lt;base&gt;){}
  };
  
  int main()
  {
      auto pd = std::make_unique&lt;derived&gt;();
      //test t(std::move(pd)); // this works;
      test t = std::move(pd); // this doesn't
  }
  </code></pre>
  
  <p>A <code>unique_ptr&lt;derived&gt;</code> can be moved into a <code>unique_ptr&lt;base&gt;</code>, so why does the second statement work but the last does not?  Are non-explicit constructors not considered when performing a copy-initialization?</p>
  
  <p>The error from gcc-8.2.0 is:</p>
  
  <pre><code>conversion from 'std::remove_reference&lt;std::unique_ptr&lt;derived, std::default_delete&lt;derived&gt; &gt;&amp;&gt;::type' 
  {aka 'std::unique_ptr&lt;derived, std::default_delete&lt;derived&gt; &gt;'} to non-scalar type 'test' requested
  </code></pre>
  
  <p>and from clang-7.0.0 is</p>
  
  <pre><code>candidate constructor not viable: no known conversion from 'unique_ptr&lt;derived, default_delete&lt;derived&gt;&gt;' 
  to 'unique_ptr&lt;base, default_delete&lt;base&gt;&gt;' for 1st argument
  </code></pre>
  
  <p>Live code is available <a href="https://wandbox.org/permlink/fVMj3mc848GCuMyC" rel="noreferrer">here</a>.</p>