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

2023-02-07


860. Explicit qualification of constexpr member functions

Section: 9.2.6  [dcl.constexpr]     Status: C++11     Submitter: Daniel Krügler     Date: 6 April, 2009

[Voted into WP at August, 2010 meeting.]

9.2.6 [dcl.constexpr] paragraph 6 says,

A constexpr specifier for a non-static member function that is not a constructor declares that member function to be const (11.4.3 [class.mfct.non.static]).

Is a const qualifier on such a member function redundant or ill-formed?

Notes from the July, 2009 meeting:

The CWG agreed that a const qualifier on a constexpr member function is simply redundant and not an error.

Proposed resolution (February, 2010):

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

A constexpr specifier for a non-static member function that is not a constructor declares that member function to be const (11.4.3 [class.mfct.non.static]). [Note: the constexpr specifier has no other effect on the function type. —end note] The keyword const is ignored if it appears in the cv-qualifier-seq of the function declarator of the declaration of such a member function. The class of which that function is a member shall be a literal type (6.8 [basic.types]). [Example:...