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

2024-10-26


1240. constexpr defaulted constructors

Section: 9.3.2  [dcl.name]     Status: C++11     Submitter: Jens Maurer     Date: 2011-02-02

[Voted into the WP at the March, 2011 meeting.]

Issue 1199 proposes to add the capability of defining a constexpr special function as deleted. It would be similarly useful to be able to mark a defaulted constructor as constexpr. (It should be noted that the existing text of 11.4.5 [class.ctor] and the proposed resolution of issue 1224 already allow for implicitly-defined constructors to be implicitly constexpr; this issue simply proposes allowing the explicit use of the constexpr specifier.)

Proposed resolution (February, 2011):

  1. Change 9.2.6 [dcl.constexpr] paragraph 3 as follows:

  2. Change 9.2.6 [dcl.constexpr] paragraph 4 as follows:

  3. In the definition of a constexpr constructor, each of the parameter types shall be a literal type or a reference to a literal type. In addition, either its function-body shall be = delete or = default or it shall satisfy the following constraints:

    A trivial copy/move constructor is also a constexpr constructor.

[Note: this resolution assumes that the changes for issue 1199 have been applied.]