Thank you for the explanations..<div><br><div class="gmail_quote">On Sun, Jul 15, 2012 at 1:38 PM, Steve Ramsey <span dir="ltr"><<a href="mailto:clang@lucena.com" target="_blank">clang@lucena.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Jul 15, 2012, at 12:59 AM, Richard Smith wrote:<br></div><div class="im">
><br>
</div><div class="im">> I'm not sure why instantiating std::function<void(X&)>::operator= would require X to be complete -- libstdc++ does not behave that way. It's possible this is a bug in libc++, but it's also possible that the standard allows this behavior and libstdc++ is just more permissive. Hopefully Howard can help with that part.<br>

<br>
</div>This is correct behavior as per FDIS 12.8.18. Specifically, since there's a user-declared copy constructor, there needs to be a user-declared copy-assignment operator, if you want one; otherwise, the implicitly declared one is defined as deleted. </blockquote>
<div><br></div><div>Excuse my ignorance, but how is there a user-declared copy constructor?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Consider:<br>
<br>
//////////<br>
<div class="im">#include <functional><br>
<br>
struct X{<br>
    typedef std::function<void(X&)> callback_type;<br>
    virtual ~X() {}<br>
</div>//    X & operator = (const X &) = default;<br>
<div class="im">private:<br>
    callback_type _cb;<br>
};<br>
<br>
int main(){}<br>
</div>/////////<br>
<br>
Uncommenting the copy-assignment operator function declaration makes the error go away. Note that in this case, the copy constructor is deleted, and the default constructor, move constructor, and move-assignment operator are suppressed.<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><div><br></div><div>Sorry again, I don't understand why you must declare the copy assignment operator as default, else it will be deleted or suppressed (you mean not generated by compiler?).  Could you please explain?</div>
<div><br></div><div>Thanks again,</div><div>Rich</div></div></div>