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

2024-04-05


837. Constexpr functions and return braced-init-list

Section: 9.2.6  [dcl.constexpr]     Status: C++11     Submitter: Mike Miller     Date: 11 March, 2009

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

The body of a constexpr function is required by 9.2.6 [dcl.constexpr] paragraph 3 to be of the form

However, there does not seem to be any good reason for prohibiting the alternate return syntax involving a braced-init-list. The restriction should be removed.

Proposed resolution (March, 2010):

  1. Change 8.7.4 [stmt.return] paragraph 2 as follows:

  2. A return statement without an expression with neither an expression nor a braced-init-list can be used only in functions that do not return a value...
  3. Change 9.2.6 [dcl.constexpr] paragraph 3 bullets 4 and 5 as follows:

Notes from the March, 2010 meeting:

The new wording added in 7.7 [expr.const] in support of reference parameters for constexpr functions should also be considered to see whether additional changes are needed.