Title
Multiple redeclarations of constexpr static data members
Status
nad
Section
11.4.9.3 [class.static.data]
Submitter
Mike Miller

Created on 2018-02-21.00:00:00 last changed 47 months ago

Messages

Date: 2018-11-15.00:00:00

Rationale (November, 2018):

Current implementations support this usage and it does not appear to cause any problems.

Date: 2022-11-20.07:54:16

According to 11.4.9.3 [class.static.data] paragraph 3,

An inline static data member may be defined in the class definition and may specify a brace-or-equal-initializer. If the member is declared with the constexpr specifier, it may be redeclared in namespace scope with no initializer (this usage is deprecated; see _N4778_.D.4 [depr.static_constexpr]).

The out-of-class declaration of a static data member was formerly a definition and thus limited to occurring only once. This limitation was lost when the in-class declaration of inline static data members became the definition; the current specification has no apparent prohibition against multiple out-of-class declarations of a constexpr static data member. Should the restriction be reinstated?

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6307
2018-02-21 00:00:00admincreate