This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1224. constexpr defaulted copy constructors

Section: 11.4.5.3  [class.copy.ctor]     Status: C++11     Submitter: Jason Merrill     Date: 2010-10-25

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

11.4.5 [class.ctor] allows for a defaulted default constructor to be constexpr, but 11.4.5.3 [class.copy.ctor] does not do the same for a defaulted copy constructor. This seems wrong.

Proposed resolution (November, 2010) [SUPERSEDED]:

Change 11.4.5.3 [class.copy.ctor] paragraph 14 as follows:

A copy/move constructor that is defaulted and not defined as deleted is implicitly defined if it is odr-used (6.3 [basic.def.odr]) to initialize an object of its class type from a copy of an object of its class type or of a class type derived from its class type123 or when it is explicitly defaulted after its first declaration. [Note: the copy/move constructor is implicitly defined even if the implementation elided its odr-use (6.3 [basic.def.odr], 6.7.7 [class.temporary]). —end note] If the implicitly-defined constructor would satisfy the requirements of a constexpr constructor (9.2.6 [dcl.constexpr]), the implicitly-defined constructor is constexpr.