https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25220

mauro russo <ing.russomauro at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ing.russomauro at gmail dot com

--- Comment #4 from mauro russo <ing.russomauro at gmail dot com> ---
hi all,

it seems that now gcc 14.2 accepts this code,

and the same do Clang and MVSC,

but in C++20 standard I still read from [class.static.data]:

p3: The declaration of a non-inline static data member in its class definition
is not a definition and may be of an incomplete type other than cv void. The
definition for a static data member that is not defined inline in the class
definition shall appear in a namespace scope enclosing the member’s class
definition. ...

P4: 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. The member shall still be
defined in a namespace scope if it is odr-used in the program and the namespace
scope definition shall not contain an initializer . ...

I was looking for existing bugs and found this old one that was correctly
rejected.
  • [Bug c++/25220] [g++] (in cla... ing.russomauro at gmail dot com via Gcc-bugs

Reply via email to