This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See for the official list.


1082. Implicit copy function if subobject has none?

Section:  [class.copy.ctor]     Status: C++11     Submitter: Jason Merrill     Date: 2010-06-22

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

It seems odd to have an implicitly declared copy constructor (and the same for the copy assignment operator) if one of the subobjects does not have one. For example,

    struct A {

    struct B: A { };

    B b;
    B b2(b); // error when implicitly defining B(B&), should not be declared

If we don't declare it in that case, we need to decide what happens if one base has only a move constructor and another has only a copy constructor.

Notes from the November, 2010 meeting:

The consensus of the CWG was to change the behavior so that all classes have a declaration of a copy constructor, but that it is defined as deleted in the cases where the declaration is omitted by the current rules.