<div dir="ltr"><div><div><div>Hello,<br><br></div>A question popped up on SO today [1]: the OP was quite surprised that he could write:<br><pre style class=""><code><span class="">struct</span><span class=""> X </span><span class="">{};<br>
<br></span><span class="">struct</span><span class=""> Y </span><span class="">{</span><span class=""> 
    Y</span><span class="">()</span><span class=""> </span><span class="">=</span><span class=""> </span><span class="">default</span><span class="">;</span><span class="">
    X</span><span class="">&</span><span class=""> x</span><span class="">;</span><span class="">
</span><span class="">};<br></span></code></pre>And not have any compiler complain about the above code.<br><br></div>Of course, as has been answered, only the instantiation of Y (and thus use of the default constructor) should actually cause an issue; and there is even a clause that the `= default` can be turned automatically (semantically wise) in a `= delete` in some cases (such as this one).<br>
<br><br></div>Still, even though this is probably very useful for template classes, it is surprising to say the least; and generally being warned earlier is better. Therefore I was wondering if there is a warning in Clang when an *explicitly* defaulted special member is *deleted* by the compiler.<br>
<div><div><div><br></div><div>I could not find it, if there is (but then there are many warnings to sift through so I might have missed it). Does anyone knows about it ?<br><br></div><div>-- Matthieu<br></div><div><br>[1]: <a href="http://stackoverflow.com/a/16076878/147192">http://stackoverflow.com/a/16076878/147192</a><br>
</div></div></div></div>