<p dir="ltr"><br>
On Apr 18, 2013 6:30 PM, "Matthieu Monrocq" <<a href="mailto:matthieu.monrocq@gmail.com">matthieu.monrocq@gmail.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> A question popped up on SO today [1]: the OP was quite surprised that he could write:<br>
><br>
> struct X {};<br>
><br>
><br>
> struct Y { <br>
>     Y() = default;<br>
>     X& x;<br>
> };<br>
><br>
> And not have any compiler complain about the above code.<br>
><br>
> 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>
> 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>

><br>
> 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 ?</p>
<p dir="ltr">Off the cuff I don't think there is one & it seems like it might be helpful.</p>
<p dir="ltr">><br>
> -- Matthieu<br>
><br>
> [1]: <a href="http://stackoverflow.com/a/16076878/147192">http://stackoverflow.com/a/16076878/147192</a><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
</p>