clang, returning std::unique_ptr with type conversion
<p>Here is my code:</p>

<pre><code>#include &lt;memory&gt;

struct A{};
struct B: A {};

std::unique_ptr&lt;A&gt; test() 
{
    auto p = std::make_unique&lt;B&gt;();

    return p;
}

int main(int argc, char **argv)
{
    test();

    return 0;
}
</code></pre>

<p>It doesn't compile on clang with error:</p>

<pre><code>main.cpp:11:12: error: no viable conversion from returned value of type 'unique_ptr&lt;B, default_delete&lt;B&gt;&gt;' to function return type 'unique_ptr&lt;A, default_delete&lt;A&gt;&gt;'
</code></pre>

<p>However, according to <a href="https://stackoverflow.com/questions/32742741/clang-error-with-stdunique-ptr">this</a> (same situation) it should. 
Did I misunderstand something?</p>

<p>My command line (clang ver 3.7):</p>

<pre><code>clang++ -std=c++14 -O2 -Wall -pedantic -pthread main.cpp &amp;&amp; ./a.out
</code></pre>