This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
Describing the handling of static data members with brace-or-equal-initializers, 11.4.9.3 [class.static.data] paragraph 4 says,
The member shall still be defined in a namespace scope if it is odr-used (6.3 [basic.def.odr]) in the program and the namespace scope definition shall not contain an initializer.
The word “shall” implies a required diagnostic, but this is describing an ODR violation (the static data member might be defined in a different translation unit) and thus should be “no diagnostic required.”
Additional notes (March, 2024)
This paragraph has more issues and is largely redundant with 6.2 [basic.def] paragraph 2.3 and paragraph 2.4.
Possible resolution:
Change 11.4.9.3 [class.static.data] paragraph 4 as follows:
If a non-volatile non-inline const static data member is of integral or enumeration type, its declaration in the class definition can specify a brace-or-equal-initializer in which every initializer-clause that is an assignment-expression is a constant expression (7.7 [expr.const]). The member shall still be defined in a namespace scope if it is odr-used (6.3 [basic.def.odr]) in the program and the namespace scope definition shall not contain an initializer . The declaration of an inline static data member (which is a definition) 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 D.5 [depr.static.constexpr]). Declarations of other static data members shall not specify a brace-or-equal-initializer.
A declaration of a static data member in a class definition shall not specify a brace-or-equal-initializer unless the member is either inline or of non-volatile const integral or enumeration type. In the latter case, the member shall be constant-initialized (7.7 [expr.const]).