<div dir="ltr"><div>I think it makes sense. For example, if you delete the copy ctor, the compiler can tell you - when you want to copy - that it's not possible, because the the copy ctor was deleted.<br></div><div><br>

</div><div>In addition, and more importantly, it allows this to behave as expected:</div><div><br></div><div>class Base {};</div><div>class Derived : public Base {};</div><div><br></div><div>struct Foo</div><div>{</div><div>

    Foo(Base* o) { ... }</div><div>    Foo(Derived* o) = delete;</div><div>};</div><div><br></div><div>Foo(new Derived); // error: that overload is deleted</div><div><br></div><div>Now if the = delete would just "remove" that overload, then the last line would compile as a call to Foo(Base*), with an implicit derived-to-base cast.</div>

<div><br></div><div>Gabor</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/16 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Wed, May 15, 2013 at 9:03 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is not a forum for learning about C++; <a href="http://stackoverflow.com" target="_blank">stackoverflow.com</a> would be a better place to ask such questions.<br>


<br><div class="gmail_quote"><div>On Wed, May 15, 2013 at 8:42 PM, ZhangXiongpang <span dir="ltr"><<a href="mailto:zhangxiongpang@gmail.com" target="_blank">zhangxiongpang@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Platform: linux, x86_84, clang++3.3 (trunk 178517), g++4.7.2<br>
<br>
I'm learning C++11 standard, and often write some code to test clang++.<br>
But sometimes I'm not sure whether my understanding is right when clang++<br>
does not work as my expecting.<br>
<br>
12.8/p23 in N3290:<br>
--------------------------------------------------------<br>
A defaulted copy/move assignment operator for class X is defined as deleted<br>
if X has:<br>
  ...<br>
  -- for the move assignment operator, a non-static data member or direct<br>
base class with a type that does<br>
     not have a move assignment operator and is not trivially copyable, or<br>
any direct or indirect virtual<br>
     base class.<br>
--------------------------------------------------------<br>
Does it partially mean that the defaulted move assignment operator for class<br>
X is defined as deleted if X has any direct or indirect virtual base class?<br></blockquote><div><br></div></div><div>In the latest draft of the standard, that bullet has been removed. (Since virtual bases can be assigned multiple times by defaulted assignment operators, this means that the compiler might generate a broken move assignment operator for classes which inherit from the same virtual base through multiple inheritance paths. I argued against this, but the committee seemed to prefer the simpler rule.)</div>



<div><br></div><div>We also have this (which doesn't help in your example, but is relevant in general):</div><div><br></div><div><div>"A defaulted move assignment operator that is defined as deleted is ignored by overload resolution (13.3, 13.4)."</div>


</div></div></blockquote><div><br></div></div></div><div>OK, that's weird. How is that different to having it not provided at all? (& it seems really unfortunate that deleted definitions do anything other than cause compilation errors - affecting overload resolution, etc, adds some substantial wrinkles to the model)</div>


<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div class="gmail_quote"><div>
</div><div><br></div><div>Clang doesn't implement this correctly in all cases yet, though.</div></div>
<br></div><div class="im">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></div></blockquote></div><br></div></div>
<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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>