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

2024-04-18


1712. constexpr variable template declarations

Section: 9.2.6  [dcl.constexpr]     Status: CD4     Submitter: Richard Smith     Date: 2013-07-08

[Moved to DR at the November, 2014 meeting.]

According to 9.2.6 [dcl.constexpr] paragraph 1,

If any declaration of a function, function template, or variable template has a constexpr specifier, then all its declarations shall contain the constexpr specifier.

This requirement does not make sense applied to variable templates. The constexpr specifier requires that there be an initializer, and a variable template declaration with an initializer is a definition, so there cannot be more than one declaration of a variable template with the constexpr specifier.

Proposed resolution (February, 2014):

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

...If any declaration of a function, or function template, or variable template has a constexpr specifier, then all its declarations shall contain the constexpr specifier. [Note:...