Clang and GCC disagree on legality of direct initialization with conversion operator : <p>The latest version of clang (3.9) rejects this code on the second line of <code>f</code>; the latest version of gcc (6.2) accepts it:</p>

<pre><code>struct Y {
    Y();
    Y(const Y&amp;);
    Y(Y&amp;&amp;);
};

struct X {
    operator const Y();
};

void f() {
    X x;
    Y y(x);
}
</code></pre>

<p>If any of these changes are made, clang will then accept the code:</p>

<ul>
<li>Remove <code>Y</code>'s move constructor</li>
<li>Remove <code>const</code> from the conversion operator</li>
<li>Replace <code>Y y(x)</code> with <code>Y y = x</code></li>
</ul>

<p>Is the original example legal? Which compiler is wrong? After checking the sections about conversion functions and overload resolution in the standard I have not been able to find a clear answer.</p>
