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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Serguei Kolos from comment #0)
> According to the article 9.4.2/4 of the C++ standard the code is probably
> missing definitions of the c1, c2 and c3 constants:
> 
> "If a static data member is of const integral or const enumeration type, its
> declaration in the class definition can specify a constant initializer which
> shall be an integral constant expression (5.19). In that case, the member
> can appear in integral constant expressions within its scope. The member
> shall still be defined in a namespace scope if it is used in the program and
> the namespace scope definition shall not contain an initializer."

Right. https://isocpp.org/wiki/faq/ctors#link-errs-static-data-mems

> But what bothers me is the fact that the same (seemingly bogus) code
> compiles fine with -OX flag. Is that normal?

Yes, see
https://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition

Reply via email to