Constexpr references
9.2.6 [dcl.constexpr]
Daniel Kr├╝gler

Created on 2010-09-04.00:00:00 last changed 96 months ago


Date: 2011-03-15.00:00:00

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

Date: 2010-11-15.00:00:00

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...
Date: 2010-11-29.00:00:00

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.)

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3329
2011-04-10 00:00:00adminsetstatus: review -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3084
2010-11-29 00:00:00adminsetstatus: open -> review
2010-09-04 00:00:00admincreate