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

2024-12-06


738. constexpr not permitted by the syntax of constructor declarations

Section: 11.4.5  [class.ctor]     Status: C++11     Submitter: James Widman     Date: 27 October, 2008

[Voted into WP at August, 2010 meeting.]

According to 11.4.5 [class.ctor] paragraph 1, only function-specifiers are permitted in the declaration of a constructor, and constexpr is not a function-specifier. (See also issue 263, in which the resolution of a similar concern regarding the friend specifier did not change 11.4.5 [class.ctor] paragraph 1 but perhaps should have done so.)

Proposed resolution (February, 2010):

Change 11.4.5 [class.ctor] paragraph 1 as follows:

Constructors do not have names. A special declarator syntax using an optional sequence of function-specifiers (9.2.3 [dcl.fct.spec]) followed by the constructor's class name followed by a parameter list is used to declare or define the constructor. The syntax uses

in that order. In such a declaration, optional parentheses around the constructor class name are ignored. [Example:...