[cfe-dev] Move constructor forces copy assignment to be implicitly defaulted?

Suman Kar skarpio at gmail.com
Tue May 29 09:40:52 PDT 2012


On Tue, May 29, 2012 at 4:34 AM, Steve Ramsey <clang at lucena.com> wrote:
> On May 29, 2012, at 1:56 AM, Suman Kar (from the future) wrote:
>
>> A quick question:
>>
>> struct A {};
>>
>> struct B : A { ~B() {} };
>>
>> A makeA() {
>> A a;
>> return a;
>> }
>>
>> B makeB() {
>> B b;
>> return b;
>> }
>>
>> int main() {
>> A a = makeA();
>> B b = makeB();
>> }
>>
>> Is it correct to assume that A will be moved and B will not? Should a
>> diagnostic be required for the call to makeB?
>
[snip explanation]
> However, B is still technically move-constructible because it will fall back to the implicitly defined copy constructor (as per the previously mentioned Note in 12.8 p9), and that copy constructor exists because of 12.8 p7.

While I understand the previous bit I'm stumped with the 'technically
move constructible' bit. Can you elaborate?

Also, I wasn't very sure about the 'default can mean delete' bit. So,
thanks for clarifying that. I'm sure I'll be getting back to this
thread and the draft in about a weeks time again!

Regards,
Suman



More information about the cfe-dev mailing list