Class template argument deduction and default template parameters : <p>The following stripped down code doesn't work with the latest clang++5 but is accepted by g++7:</p>

<pre><code>template&lt;typename Wrapped, typename U&gt;
struct wrapper;

template&lt;typename Wrapped, typename U=int&gt;
struct wrapper
{
    wrapper() = default;

    // Automatic deduction guide
    constexpr explicit wrapper(Wrapped) noexcept {}
};

int main()
{
    struct {} dummy;
    constexpr auto wrapped = wrapper(dummy);
}
</code></pre>

<p>It fails with the following error messages:</p>

<pre><code>&lt;source&gt;:18:30: error: no viable constructor or deduction guide for deduction of template arguments of 'wrapper'
    constexpr auto wrapped = wrapper(dummy);
                             ^
&lt;source&gt;:12:24: note: candidate template ignored: couldn't infer template argument 'U'
    constexpr explicit wrapper(Wrapped) noexcept {}
                       ^
&lt;source&gt;:4:8: note: candidate template ignored: could not match 'wrapper&lt;Wrapped, U&gt;' against '(anonymous struct at &lt;source&gt;:17:5)'
struct wrapper;
       ^
&lt;source&gt;:9:5: note: candidate function template not viable: requires 0 arguments, but 1 was provided
    wrapper() = default;
    ^
</code></pre>

<p>However if I move the default template parameter <code>=int</code> from the class template definition to the forward declaration, everything works perfectly (<code>U</code> being deduced to <code>int</code> as expected), as if only the default template parameter in the forward declaration was taken into account when create the set of fictional function templates used by deduction guides.</p>

<p>I tried to read the standard wording but couldn't get much out of it for this  specific case. Is only taking the default template parameter in the forward declaration the intended behaviour when generating the fictional function templates, or is this a compiler bug?</p>
