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


1194. Constexpr references

Section: 9.2.6  [dcl.constexpr]     Status: C++11     Submitter: Daniel Krügler     Date: 2010-09-04

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

9.2.6 [dcl.constexpr] restricts the constexpr specifier to object and function declarations. Especially given the support for reference types in constexpr functions, and considering that constexpr pointer declarations are permitted, there does not seem to be a good reason for excluding constexpr references.

(See also issue 1195.)

Proposed resolution (November. 2010):

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

  2. The constexpr specifier shall be applied only to the definition of an object a variable, the declaration of a function...
  3. Change 9.2.6 [dcl.constexpr] paragraph 8 as follows:

  4. A constexpr specifier used in an object declaration declares the object as const. Such an object shall be initialized. If it is initialized by a constructor call, the constructor shall be a constexpr constructor and every argument to the constructor shall be a constant expression. Otherwise, or if a constexpr specifier is used in a reference declaration, every full-expression that appears in its initializer shall be a constant expression...